Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/241131-schedule-ftp-transfers-from-php/
Share on other sites

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.

 

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.