![]() |
Getting a file extention
I am wondering how you get the file name and exstention from a $_FILES field because this doesn't work:
PHP Code:
Evan Byrne |
Never mind, I think I found the answer here > PHP File Upload
|
You could do like this as an alternative, but it is stupid to rely on mime types and extentions.
But: PHP Code:
|
I'd like to point out the pathfile function here's an example
PHP Code:
|
Sorry - double post.
|
I've used Enfernikus' way ever since I found about it. That and my other ways, apart from regular expressions, contain a function within a function, and PHP when in strict mode doesn't like that :-(
|
You could then make it into 2 variables i guess :)
But pathinfo() seems a whole lot better ;) |
The second argument wouldn't need to be added to these functions if PHP supported this:
php Code:
It's exasperating! |
Quote:
What should you use to determine the file type if you dont use mime types and file extensions? I've been having some problems creating a secure, image only file upload script. Sometimes it decides the mime type of a jpg file isn't acceptable. |
Well, frankly i don't know, but if it is images only, then you could probaly run it through some GD, but try and take a look at KalleLoad - Powered by KalleLoad it's an open source project, by Kalle here at TalkPHP :)
|
| All times are GMT. The time now is 06:30 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0