This is a migrated thread and some comments may be shown as answers.

Upload fail on IE9

2 Answers 100 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Cristian
Top achievements
Rank 1
Cristian asked on 22 Mar 2012, 01:03 PM
When trying to upload an image in ie9 it asks if I want to save or open the image. See attached screenshot. On some final user machine I have the same situation in firefox. The code is the following block:

$(function () {
    kendo.culture("it-IT");
    $("#image").hide();
    $("input:submit").addClass("k-button");
    $("textarea").addClass("k-autocomplete");
    var urlActionAddPic = $("#roomsAdd").attr("url-action");
    $("#pictures").kendoUpload({
        async: {
            saveUrl: urlActionAddPic
        },
        localization: {
            select: "Seleziona Immagine"
        },
        success: function (e) {
            WaitPopupHide();
            $("#Picture_Url").val(e.response.Url);
            $("#image").attr("src", e.response.Url);
            $(".k-upload-files").remove();
            $("#image").show();
        },
        select: function (e) {
            $.each(e.files, function (index, value) {
                if (value.extension == ".jpg" || value.extension == ".jpeg" || value.extension == ".JPG" || value.extension == ".JPEG") {
                    WaitPopupShow();
                } else {
                    ShowPopup({
                        Success: false,
                        Message: "Le immagini devo essere di tipo JPG",
                        Title: "Attenzione!"
                    });
                    e.perventDefault();
                }
            });
        },
        multiple: false
    });

I attempted to use the code for select event also in upload event: same result. I also attempted to avoid the WaitPopupShow function: same result. What I can do to resolve this behavior??

thanks 

Cristian Scotti
"

2 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 22 Mar 2012, 03:29 PM
Hi,

What is the content type of the response you're returning from the Save handler? It should be "text/plain":
    // When returning JSON the mime-type must be set to text/plain
    return Json(new { status = "OK" }, "text/plain");

or
    // Return an empty string to signify success
    return Content("");


I hope this helps.

Regards,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Cristian
Top achievements
Rank 1
answered on 22 Mar 2012, 03:33 PM
Yes, I found the error was exactly the contenttype as you wrote... It was "json" and I've corrected it to "text/plain" and now it works..

Thanks

Cristian
Tags
Upload
Asked by
Cristian
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Cristian
Top achievements
Rank 1
Share this question
or