0

i want to retrieve the path of file being uploaded by FileUpload control. i have tried FileIpload1.FileName and FileUpload1.PostedFile.FileName but both of these statements return only file name and not the path (in mozilla firefox).

Thanx

Ravi
  • 95
  • 1
  • 1
  • 8
  • have you seen this? http://stackoverflow.com/questions/1130560/get-full-path-of-a-file-with-fileupload-control – NET Experts Mar 07 '12 at 06:17
  • 1
    I think you want to know folder of client who uploads file. And if it is you want, you cannot get client folder path. – arunes Mar 07 '12 at 06:20

1 Answers1

0

Since the FileUpload is a server-side control, it does not have any property that returns complete file name and file path. To get the file path from the browser, you'll have to use javascript. Here's an example:

<form id="Form1" action="" method="post">
<input type="file" />
<input type="button" onclick="alert(this.previousSibling.value);"
value="select file and press the button" />

However, browsers never reveal the original path of the file from the client side - not even to JavaScript. So all you might get is: C:\fakepath\ + your file name

Zishan Neno
  • 2,647
  • 7
  • 34
  • 58