Jump to content

[SOLVED] File uploads breaking in curl


dpacmittal

Recommended Posts

Well, I am making this script which downloads a file from another server and uploads it to file hosting site.

 

The problem is that it breaks in between. The file size is 22mb and sometimes it uploads 15mb, sometimes 18, sometimes 9.

 

Is there anyways I can solve this or is this a server problem?

 

BTW, I am using curl to download and upload.

Link to comment
https://forums.phpfreaks.com/topic/166681-solved-file-uploads-breaking-in-curl/
Share on other sites

why would the cookie file help?

 

Try using cURL to download the file too...instead of file_get_contents()

I am using CURL for downloading the file. The user needs to login to download the file. Thats why I need the cookie file.

 

I am asking if I can use any alternate method for downloading in which I could use the cookie file for authentication.

ah, ok, well it should be pretty straight forward in determining if the problem is download or upload. I assume you know how big the file is supposed to be after downloading.

 

are we confident it's the download that is the problem? after the download completes, what is the output of:

print_r(curl_getinfo($ch));

ah, ok, well it should be pretty straight forward in determining if the problem is download or upload. I assume you know how big the file is supposed to be after downloading.

 

are we confident it's the download that is the problem? after the download completes, what is the output of:

print_r(curl_getinfo($ch));

 

Yes, I am pretty sure its the problem with downloading. I've checked the original file's size and downloaded file's size.

 

And the statement you gave didn't output anything. Is it because of error?

Thanks guys. It feels really stupid but when Rhodesa asked for code, I was copying - pasting it here, and i saw this:

 

curl_setopt($ch, CURLOPT_TIMEOUT, 50);

 

Please don't feel angry. Actually I just copied-pasted it from another script of mine which needed the timeout. I just didn't notice that I forgot to remove it.

 

Sorry for trouble, once again. It was a sheer stupidity at my part. Damn! I am embarrased.

 

Its working now.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.