Uncaught TypeError: myAwesomeDropzone.displayExistingFile is not a function

Viewed 180

I am trying to show my previous data in Dropzone but it's giving me error:

Previous File is here:

<input type="hidden" id="imageURL" value="{{ $incoming->fileName }}">

Dropzone Code:

Dropzone.options.myAwesomeDropzone = {
   paramName : 'incomingFile',
   acceptedFiles: 'image/*, application/pdf',
   init: function() {
     let myAwesomeDropzone = this;

     let mockFile = { name: "Filename", size: 12345 };
     let callback = null; // Optional callback when it's done
     let crossOrigin = null; // Added to the `img` tag for crossOrigin handling
     let resizeThumbnail = false; // Tells Dropzone whether it should resize the image first
     myAwesomeDropzone.displayExistingFile(mockFile, "https://i.picsum.photos/id/959/120/120.jpg", callback, crossOrigin, resizeThumbnail);

        }
    };

I have followed the given documentation code https://gitlab.com/meno/dropzone/-/wikis/FAQ#how-to-show-files-already-stored-on-server

But giving me the error! I can't understand, why!

Uncaught TypeError: myAwesomeDropzone.displayExistingFile is not a function

1 Answers

It seems like the reference of this is problematic. console.log(this) to see whether it matches your expectation.

Related