0

i am using this plug in for file upload

my problem is , when i click on

<input type="file" class="upload" id="imgAuthorImageUpload" accept="image/gif, image/jpeg,image/jpg,image/bmp,image/pjpeg,image/png" />

imgAuthorImageUpload - the popup will open from explore and it will let you chose the file for upload

as soon as it start to upload, i want to show that file location on page,

for example,

if i chose animal.png from d drive picture folder: then i want to display something like this

D:/Pictures/animal.png

the code i wrote like this :

$("#imgAuthorImageUpload").fileupload({
        url: '/picture/DashBoard/pictureUpload.ashx',
        dataType: 'json',
        cache: false,
        async: true,
    }).on('fileuploadadd', function (e, data) {
        e.preventDefault();
    }).on('fileuploaddone', function (e, data) {
        alert("upload done");
        e.preventDefault();
    }).on('fileuploadprogress', function (e, data) {
        var percentVal = '0%';
        var percentVal = parseInt(data.loaded / data.total * 100, 10);
        $('.bar').css(
                'width',
                percentVal + '%'
            );
        $('.percent').html(percentVal + '%');
    }).on('fileuploadcomplete', function (e, data) {
        alert("Upload complete");
    });
vir
  • 1,081
  • 4
  • 19
  • 31
  • possible duplicate of [How to get full path of selected file on change of using javascript, jquery-ajax?](http://stackoverflow.com/questions/15201071/how-to-get-full-path-of-selected-file-on-change-of-input-type-file-using-jav) – Cjmarkham Jun 30 '14 at 13:11
  • ITs not possible bcoz of security risks – Pratik Joshi Jun 30 '14 at 13:12

1 Answers1

0

For security reasons, browsers don't allow this.

A good explanation is provided here: Full path from file input using jQuery

Community
  • 1
  • 1
Nikhil Talreja
  • 2,754
  • 1
  • 14
  • 20
  • Why is He getting -1? he gave answer which is perfect – Pratik Joshi Jun 30 '14 at 13:13
  • +1 I agree Pratik, unnecessary downvote. You will not get the full path for security reasons - but you can get the file name, see [this](http://stackoverflow.com/a/24238200/3509874). – urbz Jun 30 '14 at 13:14