Upload fail on IE9

3 posts, 0 answers
  1. Cristian
    Cristian avatar
    2 posts
    Member since:
    Sep 2011

    Posted 22 Mar 2012 Link to this post

    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. T. Tsonev
    Admin
    T. Tsonev avatar
    2831 posts

    Posted 22 Mar 2012 Link to this post

    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!
  3. Cristian
    Cristian avatar
    2 posts
    Member since:
    Sep 2011

    Posted 22 Mar 2012 Link to this post

    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
Back to Top