Re: File uploads



Steve schreef:
Erwin Moller
<Since_humans_read_this_I_am_spammed_too_much@xxxxxxxxxxxxxxxx> wrote in
news:481f4365$0$14356$e4fe514c@xxxxxxxxxxxxxx:

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


how can that be done


How can WHAT be done?

Erwin Moller
.



Relevant Pages

  • Re: File excel not recognized
    ... On 30 août, 10:50, Erwin Moller ... When I upload an excel file, PHP does not recognize the type of this ... And the value application/octet-stream just means it is a binary file, ... If you upload a MS Word document to my Linux server, ...
    (comp.lang.php)
  • Re: why this load data infile doesnt work?
    ... Erwin Moller wrote: ... echo "upload failed"; ... Assuming you're relying on $upfile to be automatically globaled from ... Also, as Erwin said, you never actually execute an SQL query, you just ...
    (comp.lang.php)
  • Re: Uploading files to FTP via dialog
    ... Erwin Moller wrote: ... Currently I just have it so that the user needs to upload the ... image himself to the FTP, ... only the filename AND the file. ...
    (php.general)
  • Re: File uploads
    ... Erwin Moller ... I can easily rename bla.gif to bla.zip and upload it. ... - copyright 1988-2008 ALWIL Software. ...
    (alt.php)
  • Re: Doing two things from one submit
    ... I tried this but it then stopped sending the record to the database (still ... "Erwin Moller" ... TABLE WITH TEXT FIELDS HERE THAT ARE SENT TO THE DATABASE ... Choose a file to upload: ...
    (comp.lang.php)