I've submitted this question to Telerik forums but haven't received any reply yet so a coworker advised to post here...
We're using RadEditor with ImageManager and EnableAsyncUpload property set to true.
When trying to upload an image (a small one btw), the upload seems to go forever and when I look at Chrome's Dev Tool console, an error is logged:
Unexpected token < in JSON at position 453
Doing this on Firefox, the message changes to:
JSON.parse: Unexpected non-whitespace character after JSON data at line 1 column 454 of the JSON data
(in the end, both messages points to the same issue).
Example of Chrome error message.
When I change EnableAsyncUpload property to false, it uploads correctly and saves the image in the specified location without any problem.
I tried to debug it and saw that the problem appears when Telerik's code try to parseJSON a string that comes with more information than expected (highlighted in yellow). This information is added by the application and I can't change that.
I can leave it with EnableAsyncUpload in false but it kinda bugs me.
Is it really ok leaving EnableAsyncUpload in false? Is there a way to fix this issue?
Code is like this:
<div id="HtmlBodyCell" style="<%= HtmlBodyCellStyle %>">
<Telerik:RadEditor ID="HtmlBodyTextArea" runat="server" Width="475px" Height="400px" />
</div>
HtmlBodyTextArea.EnableFilter(Telerik.Web.UI.EditorFilters.MakeUrlsAbsolute);
HtmlBodyTextArea.ImageManager.UploadPaths = imgPath;
HtmlBodyTextArea.ImageManager.ViewPaths = imgPath;
HtmlBodyTextArea.ImageManager.MaxUploadFileSize = 200000;
HtmlBodyTextArea.ImageManager.EnableAsyncUpload = true;
HtmlBodyTextArea.ImageManager.RenderMode = RenderMode.Lightweight;
Thanks!
The case was researched at https://www.telerik.com/forums/image-manager---json-parse-error-when-uploading-images-and-image-manager-has-enableasyncupload-set-to-true.
What Gaby did to resolve it was to add a condition to the generation of the additional entry, like the Request.FilePath should not contain "Telerik.Web.UI.WebResource.axd".