Dropzone.js not uploading the file


Hi all,

client side :

<form action="upload_pkg_photo.php" class="dropzone"></form>

server side :slight_smile:


ini_set('display_errors', 'true');
include ($_SERVER["DOCUMENT_ROOT"] . "/config.php");

$storeFolder = $_SERVER['DOCUMENT_ROOT'] . BASE_PATH . "/uploads";   //2

if (!empty($_FILES)) {
    $tempFile = $_FILES['file']['tmp_name'];//3             
    $targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;  //4
    $targetPath =  . $ds. $storeFolder . $ds;  //4
    $targetFile =  $targetPath. $_FILES['file']['name'];  //5
    move_uploaded_file($tempFile,$targetFile); //6 

The uploader shows success with it’s right mark. but upload folder in my case
domain.com/demo3/uploads is empty only. i make sure it is not uplaoded outside of this by doing a search in cpanel file manager for server wide. uploaded images are not found anyware.

whats wrongs people?


Client side, you have a link to dropzone.js?


Yh the file is linked along it’s css. form works perfectly.
i got it from github, did not do any modification to it. just downlod, uploaded to file manager and linked.
ill try to get u the file link in git in a moment.

The files dropzone.js and dropzone.css are from here


The pages on GitHub don’t seem to have a lot of information on how to use it. The readme say the official repository is now at GitLab. There seems to be more information there.


strange, i adjusted the code. but no luck, demo3/uplods folder is empty,

							  <div class="row">
								<div class="col-lg-12">
									<form action="/demo3/uploads" class="dropzone">
									  <div class="fallback">
										<input name="file" type="file" multiple />


I’ve never tried this, is the leading . a typo and does it make any difference?

$targetPath =  . $ds. $storeFolder . $ds;  //4

Do you intentionally assign $targetPath on a line, then write over it on the next line?


it looks like site point code editor has remove certen part. actually the very basic dropzone.js tutorial is found here i just followed it. infact the tutorial is recommended in the official site. i have the correct syntax exactly as in tuto. yet no file is beig uploaded.



I’m still not sure what your upload folder should be, and whether it’s correct. Yours is very different to the one in the tutorial article.


let me try with tutorial default :slight_smile:


100% like in the tuto. no success :frowning:

$storeFolder = 'uploads';   //2
if (!empty($_FILES)) {
    $tempFile = $_FILES['file']['tmp_name'];          //3             
    $targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;  //4
    $targetFile =  $targetPath. $_FILES['file']['name'];  //5
    move_uploaded_file($tempFile,$targetFile); //6


Hi @afridy. and where is the client side? Something like:

Dropzone.options.yourForm = {
//Dropzone options

You need have a look on the project page


ill try with dropzone options. i am googling… Thanks.


Hi folks ,
i have come up with succes. Thanks all for the efforts. frankly i had to recall my php file upload lessons. then i undestand dropzone.js has nothing to do with server side and it only give a handle to file input. with all this lessons i was able to success fully upload the images now. it also the error log in the script path was also help full in finding erros like unable to move, file not exists etc errors. here is my final code for successfull dropzone upload.


<form action="upload_pkg_photo.php" class="dropzone"></form>
  • be sure to inclde dropzone.css and dropzone.js file in the header

server side php

if (!empty($_FILES)) {
  $errors= array();
  $file_name = $_FILES['file']['name'];
  $file_size =$_FILES['file']['size'];
  $file_tmp =$_FILES['file']['tmp_name'];
  $explode = explode(".", $_FILES["file"]["name"]);
  $file_ext = end($explode);
  $expensions= array("jpeg","jpg","png");
  if(in_array($file_ext,$expensions)=== false){
	 $errors[]="extension not allowed, please choose a JPEG or PNG file.";
  if($file_size > 2097152){
	 $errors[]='File size must be excately 2 MB';
	 move_uploaded_file($file_tmp,$_SERVER['DOCUMENT_ROOT'] . "/demo3/uploads/".$file_name);
	 echo "Success";

Thank you all!