views:

311

answers:

3

Hi friend,

I need to make new own file upload field using HTML and Javascript since Built-In file upload not showing full path of the file

I need to make it similar to file upload by using button and textbox

please help to solve this problem

+4  A: 

You can't.

There are security considerations browsers must adhere to and there is now way around that.

FYI this is also why Firefox doesn't allow drag and drop into a file field.

pstanton
+1  A: 

Just fyi, I think the path display depends on your browser.

If you're willing to/can do so, java (not javascript) might be able to help you with your original problem. Java brings it's own problems, though.

thenoviceoof
A: 

The file upload is a specific input type, which you can't easily replace, but in some browsers you may be able to style it.

You should be able to access the filename from javascript, and display this in a different part of the page (possibly hiding the file input at the same time) so the user can see what will be selected.

Another option is to use Flash for a fancier front-end (see http://www.flickr.com/photos/upload/ (assuming you have a flickr account) as an example), but I've never used one of these as a developer

Cebjyre
You'll get fake path: "C:\fake\filename.extension"
Roman Boiko