I would like to upload images found in a particular folder using FTP in a php file. I am uploading to ftp.photobucket.com, and the folder that the images are found in is dependent on user input. How I would like to do this like the following:
User Enters Folder Name (or chooses from a list) into a form field.
Folder clicks 'Add' button (this is a pre-submit button)
The form parameters are saved in localStorage, and the form is cleared, so that the user can enter new data into the form.
At this point the ftp connection opens in the background, creates the remote folder, and uploads the images (this could happen after submit to prevent multiple executions of the ftp script, but doing it at this point is preferable for time saving purposes)
User enters new data into the form while the images are being uploaded, and repeats as often as he or she chooses.
The user presses submit, and all the form data is posted to a php file, building dynamic file(s) based upon form input.
All the while the ftp process continues to upload silently in the background.
After the ftp process is complete, the user receives notification that his files are available for viewing. He may, of course, view the files before then, but the images will show up as broken links until the upload is finished.
I've got every step of this working except for running the ftp in the background. No matter what I've tried, there has been some error. I have tried various combinations of built-in ftp methods, and I've also tried running a batch script from the file system. Nothing I've found on php.net has provided anything that works.
This is on a Windows box and I have tried the psexec.exe trick(find psexec on this page) to no avail. I have now gotten confused after multiple attempts, and even debugging no longer makes any sense to me. Any help?
I forgot to add that for the purposes of making this work, this is running on localhost. Getting it to work there at first is what I need now. I'll work out the rest as needed.[/edit]
preguntado el 09 de marzo de 12 a las 14:03
You cannot send directly files to ftp using PHP. You must first upload them locally. And after you can send them to ftp using php. You can use a cron on your web host to execute the php script and send files on ftp. There is many php class to manage ftp : http://www.phpclasses.org/searchtag/ftp/by/package/tag/ftp/