I have the Uploadify jQuery plugin set up on my site to manage file uploads. Within the onUploadSuccess
event, I have this code:
'onUploadSuccess' : function(file, data, response) {
console.log("Upload complete for file " + file.name + ". Script returned: " + data);
}
This is meant to show me whatever the upload script spits out. Now, usually the response is something like this:
Upload complete for file test.jpg. Script returned: {"status":1,"file":{"id":"v8rwlxj3","name":"test.jpg"}}
The upload script is first accepting the file, then uploading it to Rapidshare using cURL like so:
// Move uploaded file
move_uploaded_file($_FILES['Filedata']['tmp_name'], $targetDir . '/' . $id);
// Get the RapidShare server to upload to
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=nextuploadserver');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!$uploadServer = trim(curl_exec($ch))) {
error('nextuploadserver failed');
}
if(strstr($uploadServer, 'ERROR:')) {
error('nextuploadserver failed');
}
// Upload the file to RapidShare
$uploadID = mt_rand(1000000000, 9999999999);
$url = 'http://rs' . $uploadServer . '.rapidshare.com/cgi-bin/rsapi.cgi?uploadid=' . $uploadID;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
$postFields = array('sub' => 'upload',
'login' => 'login',
'password' => 'password',
'uploadid' => $uploadID,
'filename' => $_FILES['Filedata']['name'],
'filecontent' => '@' . $targetDir . '/' . $id);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
if(!$resp = curl_exec($ch)) {
error('upload call failed');
}
when it's uploaded, the upload script spits out a JSON response like so:
// Output
echo json_encode(array('status' => 1, 'file' => array('id' => $id, 'name' => $uploadDetails[1])));
This works fine for smaller files. When I upload my 30MB test file however, I get this response:
Upload complete for file 30mb.txt. Script returned:
At first I thought PHP was hitting the max execution time, but I have this at the top of my script:
set_time_limit(21600); // 6 hours
And besides, I'd see the PHP error being returned. But it's just not returning anything. What could cause this? Thanks.