0

I am using jquery to upload file but on server it gets replaced with fakepath :

My path should be "C:\Users\Download\filename.xls" it gets replace with "C:\fakepath\filename.xls"

I used this approach to solve above problem but :

var selectedPath = $('input#FileData_File').val().split('\\').pop();//Filename.xls

but it gives only filename and eliminates path , how to get fullpath with filename.

Bokambo
  • 4,204
  • 27
  • 79
  • 130

1 Answers1

0
 var srcContent; // will give you the file 
 function readURL(input) {
             if (input.files && input.files[0]) {
                 var reader = new FileReader();
                 reader.onload = function (e) {
                     srcContent = e.target.result;
                 }
                 reader.readAsDataURL(input.files[0]);
             }
         }
$("#inputFile").change(function () {
                 if (this.files[0].name != "") {                    
                     readURL(this);
                 }                
             });
sujith karivelil
  • 28,671
  • 6
  • 55
  • 88