0

I want to upload an image to database using my JSP page. I am using

<input id="fileUpload" type="file" name="file">

but I am not able to read the full path of the file..

please help...

I used jQuery to read the path from the file control like shown below...

var path = $('#fileUpload').val() ;
Dan
  • 2,701
  • 1
  • 29
  • 34
Myth
  • 446
  • 7
  • 18

1 Answers1

0

I will paraphrase from the answer to this question:

For security reasons browsers do no allow this. JavaScript in the browser has no access to the File System.

The browser wont allow this due to security concerns, you need to do this on the back end and return it to the page (assuming the reason you want to do this is to show the user the path of file upload). Try an ajax call.

Community
  • 1
  • 1
Dan
  • 2,701
  • 1
  • 29
  • 34
  • I actually want to store the file to my database as bytes. So how can I do that without getting the full path – Myth Dec 03 '13 at 04:17