Page 1 of 1

Does a file exist? Or is the user being evil?

Posted: Sun Oct 01, 2006 9:04 am
by jolinar
Can anyone suggest a solution to the file upload problem i'm having at the moment. I'm standard HTML forms (with $_FILE) to upload images for a gallery.

Problem - I need to check that the file is actually where before it's added to the database. I'm thinking that I could check the size of the temporary file on the server (after upload) and checking the size. Since a 0 size file is going to be a bogus file.

Any thoughts?

Posted: Sun Oct 01, 2006 9:15 am
by ambivalent
Look at is_uploaded_file()

Also, $_FILES['userfile']['size'] can be checked to ensure a value larger than zero.