@CLab did you read his 2 and 3 paragraphs:
Quote
- Upload Files Somewhere Else
The XSS and CSRF components of this proof-of-concept relies on this file being uploaded within the application. If you upload all user files elsewhere, such as a separate media domain, block storage (i.e. S3), Content Delivery Network, etc, it limits the exposure. Cookies may no longer be passed through, which removes any privileges the script has over your site.
This is also fantastic protection against potential RCE - if the file is running on someone else’s system, it’s their problem to protect, not yours!
- Don’t Make Uploaded Files Directly Accessible
If uploaded files cannot be directly accessed in the browser, then they can’t be accessed to be executed. This may not be possible given your file upload needs, but it’s worth thinking about how you can safely store and access untrusted files without users accessing them.
Unquote
Which he said the exact same thing I have told you, don't expose to public. Furthermore I make sure all uploads are scanned for viruses and malware.
getClientOriginalName is fine if other parts are added.
Also getClientOriginalName you could only allow letters. And the other parts are added is from your code.
Also if an upload has a virus, it still has a virus even if you do use UUID.
Edit:
You could even assign an extension in an if construct for one of the allowed file types:
$newname = $filename . $lid . "." . "jpg";
But you are taking security serious, that is good. I wish others would as well, but I don't think most do.
They get an easy copy and paste answer and don't give security a second thought.
I did enterprise java ee prior to php, and security is the first thing I am concerned with.
Edit 2
I only do business type apps. I also strip_tags on all form input. I realize a forum site has to have code in the stored database, but a business app doesn't.
Edit 3
But it seems you want to use something like UUID, so just go with that. Just remember it doesn't make a file safe.