You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.
In my upload.php, I return nothing when a file fails validation (e.g. size limit). The default behavior is that an img tag will always be generated regardless of the return value of the server side uploading script.
To prevent the unnecessary image tag from being generated, I have the following in my uploadComplete function, which checks the response text if it is a valid URL.
Good point, but I see that your server returns absolute path to an uploaded image and your RegExp handles only that. To make a really universal solution, we need to think about relative paths, too.
You wrote, that your upload script returns nothing, if an image wasn't uploaded. Maybe better would be just to test, if jqxhr.responseText is empty or not. What do you think?
You can make it yourself and submit a pull request, or I will make it in the future.
Testing for blank return value is also OK. I'm just thinking if there'd be a case where the developer might want to display the error / reason. Displaying the error / reason might be "intrusive" and may not be the ideal behavior for an editor that aims to be minimalist but what would be the best way to let the user know of the error.
In my upload.php, I return nothing when a file fails validation (e.g. size limit). The default behavior is that an img tag will always be generated regardless of the return value of the server side uploading script.
To prevent the unnecessary image tag from being generated, I have the following in my uploadComplete function, which checks the response text if it is a valid URL.
The text was updated successfully, but these errors were encountered: