poddys Posted July 5, 2011 Share Posted July 5, 2011 I have a PHP program that transfers data from a Localhost system to one on our server, and which also uploads images that have been attached to reports to be uploaded. The image url's are stored in an SQL database, and the details of these are uploaded using a form along with all the other details from the SQL database, the form being received by a PHP program on the online system. The images are transferred via FTP prior to the form being submitted. The problem I am having is that if the connection is slow or there are too many images, the upload times out. I was wondering if instead of FTP'ing the images up immediately, there was a way to add them to a transfer queue, and for an FTP process to transfer them independently, thus eliminating the timeout. I would still need the process to run almost immediately, but to do the equivalent of what Ajax does, to allow a page to load with the images continuing to load in the background. Ideally the PHP script would trigger an FTP job, which would perform the transfers and then end. Does this make sense, and is there a way to do this? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/241131-schedule-ftp-transfers-from-php/ Share on other sites More sharing options...
gizmola Posted July 6, 2011 Share Posted July 6, 2011 If the connection is slow/unstable, how is doing more of the same going to help you? What operating system is the php running on? Quote Link to comment https://forums.phpfreaks.com/topic/241131-schedule-ftp-transfers-from-php/#findComment-1238755 Share on other sites More sharing options...
djlee Posted July 12, 2011 Share Posted July 12, 2011 a little late probably, but what i'd look into doing first is looking at the various CLI ftp clients. see if you can make a php communication function (or class if you like your OOP). Then use system/exec/e.c.t. calls to fire up the ftp client, add the files to its queue and then it will just work in background. Ofcourse this is dependant on finding a good cli ftp client but its the first thing that came to mind when reading your post. Theres many other ways you could look at. Use php cli to do the heavy lifting on the backend for example would probably be an easier solution. then just make a crontab entry on a php file that checks if all the files have been sent successfully, if not then try again. Quote Link to comment https://forums.phpfreaks.com/topic/241131-schedule-ftp-transfers-from-php/#findComment-1241983 Share on other sites More sharing options...
gizmola Posted July 12, 2011 Share Posted July 12, 2011 a little late probably, but what i'd look into doing first is looking at the various CLI ftp clients. see if you can make a php communication function (or class if you like your OOP). Then use system/exec/e.c.t. calls to fire up the ftp client, add the files to its queue and then it will just work in background. Ofcourse this is dependant on finding a good cli ftp client but its the first thing that came to mind when reading your post. Theres many other ways you could look at. Use php cli to do the heavy lifting on the backend for example would probably be an easier solution. then just make a crontab entry on a php file that checks if all the files have been sent successfully, if not then try again. I think it was pretty clear that the OP had those things already. There is a perfectly useable ftp library available as well, so there's no need for a "cli ftp client" whatever you meant by that. See ftp. His problem was probably related to dns issues or general network reliability outside of ftp, but he never followed up so perhaps he fixed it some other way. Quote Link to comment https://forums.phpfreaks.com/topic/241131-schedule-ftp-transfers-from-php/#findComment-1242003 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.