recursive directory drag-n-drop for chrome

This commit is contained in:
Kyle Drake 2015-05-03 15:30:55 -07:00
parent 258ef281e0
commit f00e5d0757
2 changed files with 26 additions and 4 deletions

View file

@ -246,8 +246,12 @@
this.on("error", function(file, errorMessage) {
hideUploadProgress()
location.href = '/dashboard<%= @dir ? "?dir=#{@dir}" : "" %>'
// alert('Failed: '+errorMessage)
// Guess a directory upload error
if(file.status == 'error' && file.name.match(/.+\..+/) == null && errorMessage == 'Server responded with 0 code.') {
alert('Recursive directory upload is only supported by the Chrome web browser.')
} else {
location.href = '/dashboard<%= @dir ? "?dir=#{@dir}" : "" %>'
}
})
this.on("totaluploadprogress", function(progress, totalBytes, totalBytesSent) {
@ -258,6 +262,10 @@
$('#progressBar').css('display', 'block')
$('#uploadingProgress').css('width', progress+'%')
})
this.on("sending", function(file) {
$('#uploads').append('<input type="hidden" name="file_paths[]" value="'+file.fullPath+'">')
})
}
}
</script>