0

I need to have my user send the file path to the webserver. For this i'm trying to use input file type so that user can select the file. Please note that I don't want do uploading the file. I just need the location of some file. So user should be able to do that using browse option. I know that due to some security reasons in browsers, full path is not sent to server. But can we acheive this some way. I've observed that using input type=file after user selects some file using browse option (as it is not possible to select folder), the Firefox sends the server just the filename and IE sends fullpath of file including file name.

Please note that this website is used internally so it is not a security problem at all, so don't bother about security and all.

is there anyway we can acheive this?

Thanks in advance, Sreed

2
  • There maybe a better solution, if you could explain why you need to send a local path to the server. Normally a server can't do anything with such a path anyway. Commented Mar 9, 2011 at 16:04
  • my webserver executes another app by passing it the file path. That app then use the passed file path to do some operation. Commented Mar 9, 2011 at 16:33

3 Answers 3

1

You need to use something that has access to the filesystem. BY DESIGN javascript/html cannot do this. You need to use flash, java or a browser plug-in.

Sign up to request clarification or add additional context in comments.

Comments

1

No, sadly I don't think there is.

All modern browsers will send a C:\Fakepath path. To my knowledge, this behaviour can not be changed for local networks in any browser.

I'm not sure what the state of things is for Flash-based uploaders like SWFUpload or Uploadify. Flash traditionally gives more control over such data than the native browser controls. (Edit: Uploadify seems to give you the file path. See this question: How can I get the uploaded file details from uploadify after completion however, this of course is after a completed upload, which is not what you want.)

A Java applet based solution will be able to do this, but I expect the effort to implement this is huge.

I would consider using a normal text file, and asking the user to just copy+paste the correct path.

2 Comments

Thanks for the apply. We are currently asking our users to give the path normally using input text field. But they want a browse option.
@Sreed if you speak Flash, or know a Flash developer, it may be possibly to do this there... as said, Uploadify seems to offer the possibility but it's of course coupled with an actual upload in that specific program.
0

Browsers do not let you save or even see the full file path to a selected file from the <input type="file" /> form element. I would recommend Flash or Java for your needs. You could also have the user manually type in the full path...just a thought.

1 Comment

we currently have input text implementation only. But our users want to choose the path using a browse button

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.