Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions src/widgets/dragAndDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,18 @@ function makeDraggable (tr, obj) {
)
}

/* uploadFiles
**
** Generic uploader of local files to the web
** typically called from dropped file handler
** Params
** fetcher instance of class Fetcher as in kb.fetcher
** files Array of file objects
** fileBase URI of folder in which to put files (except images) (no trailing slash)
** imageBase URI of folder in which to put images
** successHandler(file, uploadedURI) Called after each success upload
** With file object an final URI as params
*/
/** uploadFiles
**
** Generic uploader of local files to the web
** typically called from dropped file handler
**
** @param {Fetcher} fetcher instance of class Fetcher as in kb.fetcher
** @param {Array<File>} files Array of file objects
** @param {String} fileBase URI of folder in which to put files (except images) (no trailing slash)
** @param {String } imageBase URI of folder in which to put images
** @param successHandler function(file, uploadedURI) Called after EACH success upload
** With file object an final URI as params
*/
function uploadFiles (fetcher, files, fileBase, imageBase, successHandler) {
for (var i = 0; files[i]; i++) {
const f = files[i]
Expand Down Expand Up @@ -200,12 +200,6 @@ function uploadFiles (fetcher, files, fileBase, imageBase, successHandler) {
alert(msg)
throw new Error(msg)
}
} else {
var extension = mime.extension(theFile.type)
if (theFile.type !== mime.lookup(theFile.name)) {
suffix = '_.' + extension
console.log('MIME TYPE MISMATCH -- adding extension: ' + suffix)
}
}
var folderName = theFile.type.startsWith('image/')
? imageBase || fileBase
Expand Down