PHP File Upload Tutorial: Secure Image Upload with Validation, MIME Type Check and Multiple Files
Profile pictures, product photos, payment receipts, scanned IDs: sooner or later almost every PHP project needs a file upload form. It is also one of the easiest places to open a serious security hole. A careless upload script lets someone send a .php file instead of a photo, open it in the browser, and run any command they like on your server.