PHP PDO AJAX File Upload


A solution for the common problem how to insert, update, and delete data along with a file upload without refreshing or reloading the page.


AJAX File upload with automatic resize and thumbnail generation for images

plus two upload folders for the original and resized files.
The data is stored in a MySQL database via prepared PHP PDO statements.


PHP 5.6+, MySQL5+


1. Unzip the ZIP file and upload the unzipped files and folders to a new folder on your server.
2. Set the file permissions for the “upfiles” and “originals” folders to 755. If you get an error set them to 777 (UNIX 0755 and 0777).
3. Import the SQL file test.sql to your MySQL database.
4. Adjust the database connection settings in the file “connection.php”.
5. Adjust the HTTP protocol (http:// or https://) in the file “connection.php”.
6. Adjust the image format and quality format settings in the file “connection.php”.
7. Enter the URL with the new folder name in your browser address bar. Example : https://www.yourdomain/newfolder

Free support at [email protected]