Page 1 of 1

[Problem] Uploading files - changing names....

Posted: Wed Apr 30, 2003 1:39 am
by Mr. Tech
Hi!

I have this uploading script but I can't work out how to rename the file. Also, the only file extensions I want it to accept is .gif, .jpf and .png.

I searched but to many posts...

Thanks for any help!!!

Posted: Wed Apr 30, 2003 2:09 pm
by volka
you might use http://www.php.net/manual/en/function.m ... d-file.php

Code: Select all

<input type="file" name="ufile" maxlength="345678" accept="image/*" />
advises the browser that only image-mimetypes should be accepted (not trustworthy)
Using pathinfo() you can get the extension of the file and check it.
For supported image types getimagesize() can help you to retrieve the file(mime)type
Haven't checked the php4.3+ function mime_content_type() but it should do almost the same as executing the shell command file on a unix-system