Using dropzone for xampp

When I try to use Dropzone.js to handle uploading files on Xampp, I get

The server replied 0 with a code error.

What I checked so far:

  • File upload allowed in php.ini
  • I set the correct max_filesize and post_max_size values
  • Google search to find a solution (nothing found)
  • Checked directory permissions.

Please can someone help me? I also tried downloading other files, but I cannot upload the file to my xampp. What am I missing? Any help is really appreciated.

UPDATE: adding code: Download form - do not think about the action, it is from Twig / Symfony

<form id="uploadForm" name="upload" action="{{ 'upload_path' }}" class="dropzone" enctype="multipart/form-data"> <div class="dz-message" data-dz-message> <span> Drag & Drop your files here. </span> </div> </form> 

Dropzone Javascript:

 <script type="text/javascript" src="{{ asset('js/dropzone.js') }}"></script> <script type="text/javascript"> Dropzone.options.uploadForm = { accept: function(file, done) { if (file.type != "image/jpeg" && file.type != "image/png") { done("Falsches Datenformat! Ihre Datei muss als JPG oder PNG hochgeladen werden."); } else { done(); } }, success: function(file, response) { if (file.previewElement) { return file.previewElement.classList.add("dz-success"); } alert(response); }, maxFiles: 10, maxFileSize: 100 } </script> 

Php.ini settings:

file_uploads = About

post_max_size = 500M

upload_max_filesize = 100M

upload_tmp_dir = "C: \ XAMPP \ TMP"

max_file_uploads = 10

Second update:

A simple script loading without Symfony and Dropzone has now been tested, and it works fine. Dropzone has been added and it still works fine. Just coupled with symfony failing it, so I guess it could be a tweak in symfony

3rd UPDATE - SOLVED:

Well, I was able to solve the problem myself. I first uploaded the files to Chrome, and there it failed for no reason. I was confused. Then I tested it in Firefox and Internet Explorer, and it works like a charm. I was a little confused. Then I thought, “Maybe this chrome extension is causing a problem,” so I turned off the Ad Block extension. And see? Download now works even in Chrome. Therefore, if someone has the same problem, check your browser extensions!

+6
source share
1 answer

You must first change the name to upload [] to upload multiple files.

0
source

Source: https://habr.com/ru/post/985442/


All Articles