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!!!
[Problem] Uploading files - changing names....
Moderator: General Moderators
you might use http://www.php.net/manual/en/function.m ... d-file.php
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
Code: Select all
<input type="file" name="ufile" maxlength="345678" accept="image/*" />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