Mastering PHP File Upload
This is the part 1 of 2 in DropzoneJs + PHP series.
DropzoneJS is an open source library that provides drag'n'drop file uploads with image previews.
In this tutorial, we are building a multiple file upload form using DropzoneJS, and the backend will be handled by PHP.
Table Of Content
- Download DropzoneJS from this URL. We are using version 2.0.12 by the time of writing this tutorial. But this tutorial works perfectly with latest version 4.x. DropzoneJS does not rely on JQuery, you will not have to worry that, upgrading JQuery version breaks your application.
- Download dropzone.css from this URL, if you want some already made css.
- Create a folder "uploads", this is for storing uploaded files.
- Create a file "index.php", this is for the front form page.
- Create a file "upload.php", this is for handling backend file upload process.
Your folder&file structure should look like this after the preparation:
2.Work with DropzoneJS
Open file "index.php" and let us create a DropzoneJs form.
Copy the content below to "index.php" and we will go through each line of code individually.