Jump to content

File Transfer – Client to Server


Earthenware

Recommended Posts

Hi, I'd be really grateful for some help with a problem that I am having transferring data to a server.

 

My objective is simple – to transfer data from my laptop to a server using a local PHP script, no FTP clients, no browsers, no HTML forms and no exotic server software which may not be supported by all ISPs.

 

I can't find a way to do it using POST and the consensus on the Web seems to be that this is deliberate, as to allow file upload without user interaction (i.e. no SUBMIT button) would be a security breach.

 

I believe that I could do it using GET by constructing a URL that contains the data, but it looks like I would run into problems with max URL length which, depending who you read, could be anything from 2k to 8k depending on the server. I don't want to get into splitting and reassembling the data if I can avoid it.

 

I've tried FTP_PUT but I can't seem to get around the “425 Can't open data connection” problem. The Filezilla forum just assigns the problem to “malicious” routers and firewalls. I don't want to get into the guts of FTP if avoidable.

 

I can't help feeling that I am missing something. This is such a simple requirement. Would any kind person care to share their experience in dealing with such simple data transfers? Thanks.

Link to comment
Share on other sites

I can't find a way to do it using POST and the consensus on the Web seems to be that this is deliberate, as to allow file upload without user interaction (i.e. no

 

If you're the one preparing and sending the POST request, you can send whatever you want whenever you want.  If you want to automate a file-upload, write a small PHP script that uses cURL to do the upload.  Then just use normal php file upload processing on the servers to accept the file.

 

 

 

Link to comment
Share on other sites

If you're the one preparing and sending the POST request, you can send whatever you want whenever you want.  If you want to automate a file-upload, write a small PHP script that uses cURL to do the upload.  Then just use normal php file upload processing on the servers to accept the file.

This worked a treat, thanks.

I hope I'm not breaking any forum rules, but I found this nice example of both send and receive scripts.

http://www.maheshchari.com/upload-image-file-to-remote-server-with-php-curl/

Link to comment
Share on other sites

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.