Improved error message if attachment upload failed due to session
authorAlexander Ebert <ebert@woltlab.com>
Tue, 10 Sep 2013 14:24:11 +0000 (16:24 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 10 Sep 2013 14:24:11 +0000 (16:24 +0200)
wcfsetup/install/files/js/WCF.Attachment.js

index 5ca158c249009115a35d86db190670e878cbbe26..f90932bf08c9289fbea9adc8bb9aafe6a88f4807 100644 (file)
@@ -260,14 +260,14 @@ WCF.Attachment.Upload = WCF.Upload.extend({
        /**
         * @see WCF.Upload._error()
         */
-       _error: function() {
+       _error: function(data) {
                // mark uploads as failed
                this._fileListSelector.find('li').each(function(index, listItem) {
                        var $listItem = $(listItem);
                        if ($listItem.children('.icon-spinner').length) {
                                // upload icon
                                $listItem.addClass('uploadFailed').children('.icon-spinner').removeClass('icon-spinner').addClass('icon-ban-circle');
-                               $listItem.find('div > div').append($('<small class="innerError">'+WCF.Language.get('wcf.attachment.upload.error.uploadFailed')+'</small>'));
+                               $listItem.find('div > div').append($('<small class="innerError">' + (data.responseJSON && data.responseJSON.message ? data.responseJSON.message : WCF.Language.get('wcf.attachment.upload.error.uploadFailed')) + '</small>'));
                        }
                });
        }