hello, i need some help i use this script <?php $source = 'http://www.site.com/file.zip'; $target = 'file.zip'; if (@copy($source, $target)) { echo 'File copied'; } else { echo 'Could not copy file'; } ?> Code (markup): everything works great if i'm copying smaller files, largest one i copied so far was 13 MB, but i tried to copy a file that has 94 MB and it stops on 23MB, a file of 20 MB stops on 16MB, i dont' know what the problem was. I suspected on 2 things, 1.upload size limit, but it is not that, limit is 64M, ok i couldn't copy the 94 one, but the 20 MB one should work and i received an explination that it is the memory limit cause it is on 64M, is that the problem? If it is how can i change it and make it work thanks in advance
Upload limit isn't relevant in this case. It's most likely execution time - check whether it's taking too long to read the file from the remote server. It's possible that copy() was written in a very lazy way and tries to hold the whole thing in memory when using the URL wrappers but I sure hope that's not true.
Two things to check out are these set_time_limit max_execution_time Seems like what Small Potatoes is saying is correct it is timeing out before it could download the whole file. ini_set('max_execution_time',0); . As for upload_max_filesize that is mostly for POST html forms. memory_limit could affect it, but you said you have it up to 64MB so that is a bunch already then.
you guys/gals are life savers, after your advice i changed the script to work like this <?php ini_set('max_execution_time',0); $source = 'http://www.site.com/file.zip'; $target = 'file.zip'; if (@copy($source, $target)) { echo 'File copied'; } else { echo 'Could not copy file'; } ?> Code (markup): and it works like a charm, rep added to all of you, thanks a million regards