DEV Community

Discussion on: How to upload files with PHP correctly and securely

Collapse
 
renorram profile image
Renorram Brandão

Exactly! Instead of use pathinfo to get the extension, I think the best would be to have an associated array with the "mime_type" => "extension" and use the extension based on the mime type.

Collapse
 
einlinuus profile image
EinLinuus

Thank you both for your comments, I've edited the code like you said and it should be safe now :)