2

I'm building a file uploader. but I want to upload from a folder on the server so the path of the browser is restricted to

C:\wamp\www\JSSoundRecorder\upload

how can I specify the path in the html input file?? html code:

<button id="id">Open</button>
<input id="yourinputname" type="file" name="yourinputname" style="display: none;" />

jquery code:

$('#id').on('click', function() {
$('#yourinputname').trigger('click');
});

example: http://jsfiddle.net/QVAC7/

souna
  • 43
  • 3

1 Answers1

1

This is not possible due to security reasons, some browsers do not allow you to even know the local file's path, let alone set it.

Some browsers have a security feature that prevents javascript from knowing your file's local full path. It makes sense - as a client, you don't want the server to know your local machine's filesystem. It would be nice if all browsers did this. https://stackoverflow.com/a/4851614/1817690

Community
  • 1
  • 1
olive_tree
  • 1,417
  • 16
  • 23