linux - Downloading using wget in php -


i using wget in php script download images url submitted user. there way me determine size of image before downloading , restricting size of download 1mb? can possibly check url points image , not entire website without downloading?

i dont want end filling server malware.

before loading can check headers (you'll have download them though). use curl - not wget. here's example:

    $ curl --head http://img.yandex.net/i/www/logo.png     http/1.1 200 ok    server: nginx    date: sat, 16 jun 2012 09:46:36 gmt    content-type: image/png    content-length: 3729    last-modified: mon, 26 apr 2010 08:00:35 gmt    connection: keep-alive    expires: thu, 31 dec 2037 23:55:55 gmt    cache-control: max-age=315360000    accept-ranges: bytes 

content-type , content-length should indicate image ok


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -