homepage Welcome to WebmasterWorld Guest from 23.20.61.85
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Need help on uploading via FTP using a form
Need help on uploading via FTP using a form
fredfletcher



 
Msg#: 4419472 posted 7:25 am on Feb 20, 2012 (gmt 0)

Hello, I tried many different combinations to get this to work, but with no success. As always, I try my best and spend a lot of time in trying to get something to work before I ask for help on something.

My question is, how can I pass parameter from an online form, via FTP with PHP version 4?

Here is what I have so far, but am getting an error:

$path1= "../uploads/".$HTTP_POST_FILES['ufile']['name'][0];

// START FTP
// set up basic connection

$ftp_server = "mysite.com";

$conn_id = ftp_connect($ftp_server) or die("Could not connect");

// login with username and password
$ftp_user_name = "myusername";
$ftp_user_pass = "mypassword";


// upload $file - Either FTP_ASCII or FTP_BINARY
if (ftp_fput($conn_id, $target, $HTTP_POST_FILES["ufile"]["name"], FTP_BINARY))
{
echo "Successfully uploaded $target\n";
}

else
{
echo "There was a problem while uploading $source\n";
}

// close the connection and the file handler
ftp_close($conn_id);


// END FTP

 

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4419472 posted 8:09 am on Feb 20, 2012 (gmt 0)

You can't upload from the client using FTP if that is what you are trying to do? You will need to use the standard HTTP. FTP is for server to server file transfers.

fredfletcher



 
Msg#: 4419472 posted 4:20 pm on Feb 20, 2012 (gmt 0)

Thanks, I thought I was able to use FTP instead of HTTP via a form to upload files. My mistake.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved