Earthenware Posted March 1, 2012 Share Posted March 1, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/258050-file-transfer-%E2%80%93-client-to-server/ Share on other sites More sharing options...
blacknight Posted March 1, 2012 Share Posted March 1, 2012 with out using post with a submit you will have to supply username and password to the server and use fpt to automate any thing other wide your server will drop the upload Quote Link to comment https://forums.phpfreaks.com/topic/258050-file-transfer-%E2%80%93-client-to-server/#findComment-1322800 Share on other sites More sharing options...
kicken Posted March 1, 2012 Share Posted March 1, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/258050-file-transfer-%E2%80%93-client-to-server/#findComment-1322839 Share on other sites More sharing options...
Earthenware Posted March 2, 2012 Author Share Posted March 2, 2012 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/ Quote Link to comment https://forums.phpfreaks.com/topic/258050-file-transfer-%E2%80%93-client-to-server/#findComment-1323048 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.