I want to use wget (executed from a php script) to download image files, but don't want to download files over a certain size.
Can I limit file size with wget? If not, what is a better way to do this?
|
I want to use wget (executed from a php script) to download image files, but don't want to download files over a certain size. Can I limit file size with wget? If not, what is a better way to do this? |
|||
|
|
|
If you are scripting downloads, you should consider using
The note about this only working for some files is worth considering. The client is dependent on the server to report how big the file is going to be before it starts downloading. Most but certainly not all servers report this. |
|||||
|
|
If you want to use wget, here is a way to test the size of the file without downloading:
where So you can condition your script based on the output. such as:
for limiting the download size to 20 MB. (the code is ugly, for informational purposes only). |
||||
|
|
|
There doesn't seem to be any reasonable way to set a max file size with wget. |
|||||
|