MCPcopy
hub / github.com/dropzone/dropzone / addFile

Method addFile

src/dropzone.js:772–805  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

770 }
771
772 addFile(file) {
773 file.upload = {
774 uuid: Dropzone.uuidv4(),
775 progress: 0,
776 // Setting the total upload size to file.size for the beginning
777 // It's actual different than the size to be transmitted.
778 total: file.size,
779 bytesSent: 0,
780 filename: this._renameFile(file),
781 // Not setting chunking information here, because the acutal data — and
782 // thus the chunks — might change if `options.transformFile` is set
783 // and does something to the data.
784 };
785 this.files.push(file);
786
787 file.status = Dropzone.ADDED;
788
789 this.emit("addedfile", file);
790
791 this._enqueueThumbnail(file);
792
793 this.accept(file, (error) => {
794 if (error) {
795 file.accepted = false;
796 this._errorProcessing([file], error); // Will set the file.status
797 } else {
798 file.accepted = true;
799 if (this.options.autoQueue) {
800 this.enqueueFile(file);
801 } // Will set .accepted = true
802 }
803 this._updateMaxFilesReachedClass();
804 });
805 }
806
807 // Wrapper for enqueueFile
808 enqueueFiles(files) {

Callers 5

setupHiddenFileInputMethod · 0.95
handleFilesMethod · 0.95
_addFilesFromItemsMethod · 0.95
readEntriesMethod · 0.95
test.jsFile · 0.80

Calls 8

_renameFileMethod · 0.95
_enqueueThumbnailMethod · 0.95
acceptMethod · 0.95
_errorProcessingMethod · 0.95
enqueueFileMethod · 0.95
uuidv4Method · 0.80
emitMethod · 0.80

Tested by

no test coverage detected