mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 07:55:46 +01:00
better error message if image upload fails, #1052
This commit is contained in:
@@ -604,10 +604,8 @@ define(['taskbar'], function(taskbar) {
|
|||||||
clearForm: true,
|
clearForm: true,
|
||||||
formData: formData,
|
formData: formData,
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
app.alertError('Error uploading file! ' + xhr.status);
|
app.alertError('Error uploading file!\nStatus : ' + xhr.status + '\nMessage : ' + xhr.responseText);
|
||||||
composer.posts[post_uuid].uploadsInProgress.pop();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
uploadProgress: function(event, position, total, percent) {
|
uploadProgress: function(event, position, total, percent) {
|
||||||
var current = textarea.val();
|
var current = textarea.val();
|
||||||
for(var i=0; i<files.length; ++i) {
|
for(var i=0; i<files.length; ++i) {
|
||||||
@@ -615,7 +613,6 @@ define(['taskbar'], function(taskbar) {
|
|||||||
textarea.val(current.replace(re, files[i].name+'](uploading ' + percent + '%)'));
|
textarea.val(current.replace(re, files[i].name+'](uploading ' + percent + '%)'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
success: function(uploads) {
|
success: function(uploads) {
|
||||||
|
|
||||||
if(uploads && uploads.length) {
|
if(uploads && uploads.length) {
|
||||||
@@ -626,8 +623,11 @@ define(['taskbar'], function(taskbar) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
composer.posts[post_uuid].uploadsInProgress.pop();
|
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
|
},
|
||||||
|
complete: function(xhr, status) {
|
||||||
|
uploadForm[0].reset();
|
||||||
|
composer.posts[post_uuid].uploadsInProgress.pop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ var path = require('path'),
|
|||||||
deleteTempFiles();
|
deleteTempFiles();
|
||||||
|
|
||||||
if(err) {
|
if(err) {
|
||||||
return res.json(500, {message: err.message});
|
return res.json(500, err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(200, images);
|
res.json(200, images);
|
||||||
|
|||||||
Reference in New Issue
Block a user