Re: File uploads



Steve schreef:
Hiya all,

Need a bit of help. Doing a small upload script that i want to limit to only uploading some file types, like .zip .ace .rar . how can I check that only these files are being uploaded?

thanks

Hi,

http://nl3.php.net/manual/en/features.file-upload.php

Use $_FILES['userfile']['name'] to find the original filename.
Simply check the extension (if any), and refuse the file if it isn't ..zip or .ace etc..

Warning, I can easily rename bla.gif to bla.zip and upload it.
Finding out if the file is what it claims to be is a lot harder.

Regards,
Erwin Moller
.



Relevant Pages

  • Re: File uploads
    ... Steve schreef: ... Doing a small upload script that i want to limit ... I can easily rename bla.gif to bla.zip and upload it. ... Erwin Moller ...
    (alt.php)
  • Re: [PHP] Rename generates level 2 warning but works
    ... >> of time yesterday with an upload script that did not recognize files when ... Still getting the warning AND the rename function works. ...
    (php.general)
  • PHP IP Checking...
    ... On my server/website I have a very basic upload script and page. ...
    (alt.php)
  • Re: file upload form with network solutions
    ... If they allow ASP you can try www.asp101.com ... for an Upload Script ... is there a cgi script that does? ...
    (microsoft.public.frontpage.extensions.windowsnt)
  • Re: mkdir in a 755 dir
    ... i'm trying to write an upload script on a web server that will not ... allow me to change the ownership or group name of a directory. ... physically create /public_html/uploads to be 777 so that i can upload ...
    (comp.lang.php)