Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php ftp uploading question

Status
Not open for further replies.

Kliot

Programmer
Jan 10, 2003
622
US
I'm new to php and am wondering if it is possible to write a php program that will upload files from my windows machine to my hosted website.

Ideally I would like to do this with ftp, I have no problem writing a program that uses a html form with file uploading and then using ftp_put to place the file. My problem is I can't find a way to do this without using the html form ideally I would like to do something like:

$destination_file = "public_html/fileToUpload"; //directory on web server
$source_file = "c:\\fileToUpload"; // file on my local computer

$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_ASCII);

Is this possible?

Thanks in advane
Perrin
 
You can use the same code as a form would use. Simply define all the required variables that would be submitted through the form before the code is executed.

·genoa

If a dog craps in the yard and buries it, is that considered steganography?
 
I'm not really sure how to go about that. It appears to me that the form's file function uses the browser's upload capability to upload a temporary file that the ftp server then can use as a local file. I would like to find a way to do that with php code or better yet I would like to have the ftp server use my computer as a local resource.

Perrin
 
Are you simply trying to mirror everything on your PC's folder to the public FTP server? Have you searched for freeware that monitors a PC folder and uploads the contents to an FTP location?

- - picklefish - -

Why is everyone in this forum responding to me as picklefish?
 
tickelfish,

Yes, I can definitly do this with ftp software I'm just wondering if I can do it with php. Php would give me the advantage of not having to have ftp software installed on the local machine. I also have some files that I upload then run cgi scripts on and it would be nice if I could do both steps with one php script.

Perrin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top