7

Drag and drop or click here to upload your image area is not working if error message is shown. If I try to add an image into a post and provide a wrong URL(not intentionally) which is not in the format recognized by SE sites it displays me,

Failed to upload image; the format is not supported | Close

This is okay. But the option,

Drag and drop or click here to upload your image (max 2 MiB)

shown above this error message is not responding on-mouse-click unless I click the Close to clear the error message shown below this message.

enter image description here

(i.e.) The local file upload window is not opening. However, the drag and drop functionality works fine even if the error message is shown. So the upload window works partially.

Expected behavior:

When I click the "Click here to upload your image", it should always open me the file upload window and clear any error messages shown below.

Tested on:

Firefox 39 and Chrome 44 in Windows 7 PC

  • 1
    +1 Definitely needs a tweak here... Error should overlay the box above or make it more obvious to force the 'Close' link for the current behavior. Or, just enable the 'Click here to upload your image' – HackerKarma Sep 23 '15 at 13:14
3

This is fixed in build 3740 on MSE/MSO, and build 2863 on other sites. Thanks to Ilmari Karonen for diagnosing the issue.

I don't like duplicating code, so I extracted that statement out into a miscCallbacks.resetInputs function. ;-)

4

This happens because the upload error handler in the file upload dialog code fails to re-enable the (hidden) file input field which is temporarily disabled during the upload process. Here's a single-line patch against image-upload.js (as included in wmd.en.js) to fix this bug:

--- image-upload.js 2015-09-23 20:03:50.149854431 +0300
+++ image-upload.fixed.js   2015-09-23 20:04:57.849853663 +0300
@@ -289,6 +289,7 @@

             var miscCallbacks = {
                 uploadError: function (msg) {
+                    dialog.find('.modal-input-file, .modal-input-url').prop('disabled', false).attr('value', '');
                     dialog.find('.modal-options-error .modal-options-error-message').text(msg);
                     setTabPage('modal-options', 'error');
                 },

(The added line is copied verbatim from eventListeners.resetView in the same code.)

While waiting for someone at SE to apply this patch, I've added a client-side fix to the SOUP user script that simply runs the same line of code in a mousedown handler on the "click here" area, activated just before the normal click handler runs. This fix will be part of SOUP v1.38, due to be released in a few days. Impatient folks can try it out already by installing the development version of SOUP.

  • In case you're curious, the unused input field is disabled so that its value is not sent to the server; the server distinguishes between a file upload and a URL by seeing if a file-upload field value is sent. – Chris Jester-Young Oct 3 '15 at 7:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .