PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 536 All time: 5,616 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
Age: 44
All time rank: 50828 in India India
Week rank: 270 Up22 in India India Up

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  
File Role Description
Plain text file include.php Class Class file
Accessible without login Plain text file index.php Example index page

 Version Control Unique User Downloads Download Rankings  
 0%
Total:536
This week:0
All time:5,616
This week:206Up
User Comments (4)
not very useful at all.
8 years ago (Haseeb Ahmad Basil)
22%StarStar
not very useful at all.
8 years ago (Haseeb Ahmad Basil)
22%StarStar
not very useful at all.
8 years ago (Haseeb Ahmad Basil)
22%StarStar
not very useful at all.
8 years ago (Haseeb Ahmad Basil)
22%StarStar