Go Back   Site Owners Forums - Webmaster Forums > Search Engine Optimization > Search Engine Optimization

Notices


 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 07-27-2013, 03:38 AM   #1
binarynpixel
Registered User
 
Join Date: Apr 2013
Location: Sydney
Posts: 127
FTP upload with cURL.

PHP does have a FTP library, but you can also use cURL to upload files on a FTP server. Here is a working example:
// open a file pointer
$file = fopen("/path/to/file", "r");

// the url contains most of the info needed
$url = "ftp://username[email protected]:21/path/to/new/file";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// upload related options
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize("/path/to/file"));

// set for ASCII mode (e.g. text files)
curl_setopt($ch, CURLOPT_FTPASCII, 1);

$output = curl_exec($ch);
curl_close($ch);
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
binarynpixel is offline   Reply With Quote

 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP File upload ncjbhd ASP 32 05-19-2015 12:01 AM
How can we upload files in PHP? noahwilson PHP / mySQL 4 11-05-2013 11:34 PM
Need help with image upload and manipulation. noahwilson Programming General 0 06-05-2013 09:36 PM
How to upload things. ncjbhd PHP / mySQL 1 11-08-2011 05:04 AM
image upload mjvndhsb PHP / mySQL 0 09-15-2011 12:39 AM


All times are GMT -7. The time now is 07:16 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.