Receiving the following error:
JavaScript runtime error: Sys.ArgumentException: Cannot deserialize empty string
Parameter name: data
The custom save javascript does the following:
var fileName = imageEditor.get_serverImageUrl();
imageEditor.saveImageOnServer(fileName, true);
The server-side code is as follows:
If e.FileName <> "" Then
Dim img As ImageEditor.EditableImage = e.Image.Clone()
Dim strFilePath As String = Server.MapPath(e.FileName)
e.OverwriteFile = True
img.Image.Save(strFilePath)
e.Cancel = True
End If
4 Answers, 1 is accepted
Such an error could be experienced if you are trying to save a big image when the ImageEditor is used in enabled CanvasMode. If this is the case, you can fix this by configuring the size of the allowed JSON string length:
<
telerik:RadImageEditor
ID
=
"RadImageEditor1"
runat
=
"server"
ImageUrl
=
"Tulips.jpg"
>
<
EditableImageSettings
MaxJsonLength
=
"4097152"
/>
</
telerik:RadImageEditor
>
In case this does not help in solving the case I will need to ask you for a sample project reproducing the issue, so we could examine it on our side.
Regards,
Veselina Raykova
Telerik
I was experiencing this same issue. When using the server side ImageSaving event, it randomly would not fire when saving some images. I tried setting CanvasMode="No" as I found in other posts and I also tried increasing the MaxJsonLength. It did not resolve it. I then tried to implement my own save button to see if that would work. So I implemented the button and used the javascript from other examples I found to send the request to the server. This is nice because it makes the unneeded dialog go away.
ie = $find("<%=MyImageEditor.ClientID %>");
ie.saveImageOnServer("tempfile", true); // file, overwrite
This also did not work. It would fail saying "cannot deserialize empty string".
I also tried making my own server side button click event and inside that tried to get the image.
Dim foo As EditableImage = MyImageEditor.GetEditableImage()
This code would run server side but when I tried to GetEditableImage(), it failed saying "Illegal characters in path."
I was getting very frustrated, but I finally got it to work. Previous posts had said to set CanvasMode="No". I changed this from No to Automatic. Suddenly everything worked as it should. The random ImageSaving "event not firing" issue went away and also using my own server side code, I could now getEditableImage(), etc. I hope this helps someone because I spent HOURS. For me it was the combination of setting CanvasMode="Automatic" and increasing the MaxJsonLength.
Hi Josh,
Can you, please, confirm that you increased the maxJsonLenght both in imageEditor and on application level (in the web.config)?
https://docs.telerik.com/devtools/aspnet-ajax/controls/imageeditor/functionality/saving-large-images
<telerik:RadImageEditor RenderMode="Lightweight" ID="RadImageEditor1" CanvasMode="Yes" runat="server" ImageUrl="~/Images/image.jpg">
<EditableImageSettings MaxJsonLength="2147483640" />
</telerik:RadImageEditor>
web.config
<configuration>
<system.web>
<httpRuntime maxRequestLength="2147483640"/>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483640"/>
</webServices>
</scripting>
</system.web.extensions>
</configuration>
Regards,
Vessy
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).
Hi Vessy,
Yes, I do have the maxJsonLength set in the webconfig as well. It matches what I have set on the radimageeditor control. If I change canvasmode property from "automatic" back to "No", it doesn't work again. (Illegal characters in path)
Telerik_UI_for_ASP.NET_AJAX_2020_1_219_Dev_hotfix\Bin45\Telerik.Web.UI.dll
It's working for me to have canvasmode="Automatic" so that is fine. In my case.