Using dropzone.js, I had no problems with its operation, including obtaining images previously uploaded to the server.
The only problem I encounter is when I retrieve these files from the server to refresh the page (which means that they were not downloaded during the current use of this page), a progress bar is constantly showing. Is there a way to suppress the progress bar of previously uploaded images? I would like to continue to use progress bars at boot and don't want to remove css from the template.
Not that it was useful in this case, but here is the code that I use to extract the files and display them in a remote div div.
Dropzone.options.myDropzone = { previewsContainer: document.getElementById("previews"), init: function() { thisDropzone = this; $.get('../cgi/fileUpload.php', function(data) { $.each(data, function(key,value) { var mockFile = { name: value.name, size: value.size}; thisDropzone.options.addedfile.call(thisDropzone, mockFile); thisDropzone.options.thumbnail.call(thisDropzone, mockFile, value.uploaddir+value.name); var strippedName = (value.name).slice(11); fileList[i] = {"serverFileName" : value.name, "fileName" : value.name, "fileSize" : value.size, "fileId" : i }; i++; var removeButton = Dropzone.createElement("<button class=\"btn btnremove\" style=\"width: 100%;\">Remove file</button>"); var _this = this; removeButton.addEventListener("click", function(e) { e.preventDefault(); e.stopPropagation(); thisDropzone.removeFile(mockFile); }); mockFile.previewElement.appendChild(removeButton); }); }); }, url: "../cgi/fileUpload.php" };
source share