yegorpb
02-28-2007, 01:18 AM
Is there another way to move files to another server via php? My script accepts uploads from users, and I store the uploads on my media server, so I currently have to use ftp_put to move the files after upload. The problem, is that it doesn't work very reliably with larger files (20mb+). Are there any alternatives?
Xeentech
02-28-2007, 11:08 AM
PHP has bindings for cURL. That has a lot more options other than FTP and might be more stable. I use it to HTTP PUT things on the back end storage my self in a similar way you are doing. After my site receives an upload from a user it transcodes video or unzips zip files and sends them off to the other server.
yegorpb
02-28-2007, 12:21 PM
Is there a quick guide on cURL usage for this purpose?
Xeentech
02-28-2007, 12:59 PM
I've never used the PHP wraper.. my back end use's perl, which mostly copied the C API.
The docs on the PHP bindings are Here - http://curl.haxx.se/libcurl/php/ (http://curl.haxx.se/libcurl/php/). They also have some example scripts/apps which is where I got started originally.
xgoth3
02-28-2007, 01:53 PM
Here is a very useful explanation and example on how to use cURL to put files:
http://www.jellyandcustard.com/2006/01/02/php-curl-http-put-ssl-and-basic-authentication/
If you have shell access to the server I would suggest you to use rsync instead.
Regards.