Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- generateUploadCallback: function(onUploadSuccess) {
- return function () {
- var form = <HTMLFormElement> document.getElementById('uploadForm');
- var formData = new FormData(form);
- // TODO: fail if the user selected more than one file
- $.ajax(
- {
- url : '/web/upload',
- type : 'POST',
- data : formData,
- processData: false,
- contentType: false,
- cache : false,
- success : onUploadSuccess,
- error : function (request, status, error) {
- console.error(
- `MOEsaic upload: ${error}\n${request.responseText}`
- );
- moesaic.ui.message_dialog.show(
- 'Server ERROR',
- 'Upload failed.',
- function() {
- // return to the default upload page
- window.location.href = 'moesaic.html';
- }
- );
- }
- }
- );
- };
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement