$innerError.html($errorMessage);
- // reset value of file input (the 'files' prop is actually readonly!)
- if (this._fileUpload) {
- this._fileUpload.attr('value', '');
- }
-
return false;
}
* @see WCF.Upload._upload()
*/
_upload: function() {
- if (!this._validateLimit()) {
- return false;
+ if (this._validateLimit()) {
+ this._super();
}
- this._super();
-
- // reset value of file input (the 'files' prop is actually readonly!)
if (this._fileUpload) {
- this._fileUpload.attr('value', '');
+ // remove and re-create the upload button since the 'files' property
+ // of the input field is readonly thus it can't be reset
+ this._removeButton();
+ this._createButton();
}
},
*/
_createButton: function() {
if (this._supportsAJAXUpload) {
- this._fileUpload = $('<input type="file" name="'+this._name+'" '+(this._options.multiple ? 'multiple="true" ' : '')+'/>');
+ this._fileUpload = $('<input type="file" name="' + this._name + '" ' + (this._options.multiple ? 'multiple="true" ' : '') + '/>');
this._fileUpload.change($.proxy(this._upload, this));
- var $button = $('<p class="button uploadButton"><span>'+WCF.Language.get('wcf.global.button.upload')+'</span></p>');
+ var $button = $('<p class="button uploadButton"><span>' + WCF.Language.get('wcf.global.button.upload') + '</span></p>');
$button.prepend(this._fileUpload);
}
else {
- var $button = $('<p class="button uploadFallbackButton"><span>'+WCF.Language.get('wcf.global.button.upload')+'</span></p>');
+ var $button = $('<p class="button uploadFallbackButton"><span>' + WCF.Language.get('wcf.global.button.upload') + '</span></p>');
$button.click($.proxy(this._showOverlay, this));
}
this._buttonSelector.append(button);
},
+ /**
+ * Removes the upload button.
+ */
+ _removeButton: function() {
+ var $selector = '.uploadButton';
+ if (!this._supportsAJAXUpload) {
+ $selector = '.uploadFallbackButton';
+ }
+
+ this._buttonSelector.find($selector).remove();
+ },
+
/**
* Callback for file uploads.
*/