File Upload [php]



I’m trying to upload some files via a php script, however I’m running into a curl error and I’m not sure where I’m doing it wrong. This is the code I’m trying to run:

$Connection->create_object('mysqlbackups', $folder.'.tar.gz', array( 'fileUpload' => $folder.'.tar.gz' ));

And this is the error I get. What should I be doing differently?

Fatal error: Uncaught exception 'cURL_Exception' with message 'cURL resource: Resource id #16; cURL error: select/poll returned error (cURL error code 55). See for an explanation of error codes.' in /home/zastica/mysqldump/AWSSDKforPHP/lib/requestcore/requestcore.class.php:843
Error 55 is a very helpful "CURLE_SEND_ERROR (55) Failed sending network data. "
And this seems to work just fine:

$response = $Connection->create_object('mysqlbackups', $folder.'.tar.gz', array( 'body' => file_get_contents($folder.'.tar.gz') ));


I don’t have any comforting information to pass along. I tried this both ways and didn’t have any issues.

$Connection->create_object(‘jlund-dev’, ‘test1.txt’, array(
‘fileUpload’ => ‘/tmp/test1.txt’

$Connection->create_object(‘jlund-dev’, ‘test2.txt’, array(
‘body’ => file_get_contents(’/tmp/test2.txt’)

FWIW, others reported similar problems with a possible culprit the version of curl.


Interesting… This is what php -info and curl --version report.

cURL Information => libcurl/7.18.2 OpenSSL/0.9.8g zlib/ libidn/1.8 libssh2/0.18


This came up again and we found a way to work around the problem.

To test, we enabled verbose curl logging:

$Connection->create_object('mysqlbackups', $folder.'.tar.gz', array( 'fileUpload' => $folder.'.tar.gz', 'curlopts' => array(CURLOPT_VERBOSE => TRUE) ));

In doing so, we saw multiple appearances of Content-Length headers. This caused the request to fail with a 400 error. Upgrading the version of curl did resolve this.

If for some reason you can’t upgrade the version of curl, you can hack the SDK - look for this line in s3.class.php and comment it out:


Thanks, worked for me (using curl 7.21).


You may have to comment out in more places if you have over 100megs of file. I really wanna burn S3 on fire sometimes :wink:

This is the current s3.class.php I’m using: