I'm working on a web gallery and uploading a file raises a lot of security concerns.
This is what I have so far:
Uploading:
Retrieving:
My question is, is there anything I missed? Also, is much cpu power (this is very vague question, but let's say I have to display 10 images per user to 100 users per sec) would the application use to retrieve an image with gd. I can test it by myself, but it would be great to hear from someone who has experience with it. Many images (over 10) will be displayed at each connection which is why this is important.
Many people are not getting the security you are trying to provide. Good work, images are a source of malware in the comment part of even a real image, so you are right it checking. GD will probably use more resources then you want. you might want to use readfile instead. Reading the mime type, set the header, then output it. That will hide it. Even that might use a lot of resources. Also look at mod_xsendfile IF you can install that, it is as fast as a file transfer and will do what you are looking to do. This will help: http://blog.insicdesigns.com/2009/01/secure-file-upload-in-php-web-applications/
AD.1 Get extension from file and save as rand uniq name 736217361236123.png AD.4 Disable httacess in this dir