1

hello i am trying to get full path of ken-do upload control in jquery but its showing only

c:/fakepath/ImageName.jpg 

so anyone can tell me how can i get full path of kendo upload in jquery. this is my jquery.

function onSelect(e) {
        alert("Select");
        var src = $("#files").val();
        var path = $("#files").attr("src");
        alert(src);
        alert(path);
    }

this is my kendo

 <div>
                    @(Html.Kendo().Upload()
                    .Name("files")
                    .Multiple(false)
                    .Messages(msg => msg.Select("Browser"))
                    //.Async(a=>a.AutoUpload(false).Save("Save","Imagetest"))
                    .Events(e => e
                    .Select("onSelect").Remove("onRemove"))
                    )
                </div>
Durgpal Singh
  • 11,481
  • 4
  • 37
  • 49

1 Answers1

2

In simple words, you cannot, at least not in all browsers. Due to security restrictions of browser you cannot get the actual file path on the disk.

Although there are some workarounds to get file path (through ActiveX, Silverlight etc), you may not be able to get consistent behavior.

ramiramilu
  • 17,044
  • 6
  • 49
  • 66
  • so how can i show image on google chrome browser by using kendo grid. – Durgpal Singh Jan 10 '15 at 12:47
  • You can use `FileReader` of HTML5 http://stackoverflow.com/questions/14069421/in-html5-how-to-show-preview-of-image-before-upload, but beware that it will not work in old versions of browser. – ramiramilu Jan 10 '15 at 12:50
  • k thanks only filereader way to get image path. any other way? – Durgpal Singh Jan 10 '15 at 12:51
  • As I told you, there are other options like ActiveX, Silverlight etc., but those come with their own problems with permissions etc. – ramiramilu Jan 10 '15 at 12:54
  • The only promising way is to upload the image to server and then get the server url and display it as preview. If user doesn't want to save the image then you can delete the image from server. – ramiramilu Jan 10 '15 at 12:54