PHP Classes

PHP CURL Upload File: Send an uploaded file to a remote server with CURL

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 536 All time: 5,619 This week: 206Up
Version License PHP version Categories
curl-file-upload 1.0.0Freeware5HTTP, PHP 5, Files and Folders
Description 

Author

This is a simple class that send an uploaded file to a remote server with CURL.

It can send a HTTP POST request to upload a file that was uploaded to the local Web server using the CURL extension.

The local file can also be copied to a given directory.

Picture of Pravin Sonawane
  Performance   Level  
Name: Pravin Sonawane <contact>
Classes: 4 packages by
Country: India India

Example

<?php
   
include("include.php");
   
$msg = '';
    if (isset(
$_POST['btnUpload']))
    {
       
$up = new curlupload();
       
$r = $up->request($_FILES,$_FILES['file']['name']);
        if (
$r == true)
           
$msg = "File Uploaded Sucessesfully...";
        else
           
$msg = $r;
    }
?>
<html>
<head>
<title>File Upload Using PHP and cURL - php-guru.in</title>
<style type="text/css">
body
{
    font-family:Verdana, Geneva, sans-serif;
    font-size:12px;
}
</style>
</head>
<body>
<font style="color: red;"><?php echo ucfirst($msg);?></font><br>
<br>
<table border="1" cellspacing="0" cellpadding="3" style="border-collapse:collapse;" bordercolor="#CCCCCC">
  <form action="" method="post" name="frmUpload" enctype="multipart/form-data">
    <tr>
      <td>Upload</td>
      <td align="center">:</td>
      <td><input name="file" type="file" id="file"/></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td align="center">&nbsp;</td>
      <td><input name="btnUpload" type="submit" value="Upload" /></td>
    </tr>
  </form>
</table>
</body>
</html>


  Files folder image Files (2)  
File Role Description
Plain text file include.php Class Class file
Accessible without login Plain text file index.php Example index page

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:536
This week:0
All time:5,619
This week:206Up
User Comments (4)
not very useful at all.
9 years ago (Haseeb Ahmad Basil)
22%StarStar
not very useful at all.
9 years ago (Haseeb Ahmad Basil)
22%StarStar
not very useful at all.
9 years ago (Haseeb Ahmad Basil)
22%StarStar
not very useful at all.
9 years ago (Haseeb Ahmad Basil)
22%StarStar