Solved

FileUpload

Posted on 2008-10-24
2
300 Views
Last Modified: 2013-12-17
I have some code which returns the file name which has been selected using the standard file uploader control. Here is the code;

Response.Write(FileUpload1.FileName + "<br>");

I need to be able to return the file location of the file which has been selected using the standard file uploader control. I am not sure how to do this.
0
Comment
Question by:Mr_Shaw
  • 2
2 Comments
 
LVL 10

Accepted Solution

by:
jinn_hnnl earned 500 total points
ID: 22795916
Hi,

FileUpload1.PostedFile.FileName;

This would return a full path of the posted file. But for different browser the information send along will be different.

This should work perfectly for IE versions.

JINN

0
 
LVL 10

Expert Comment

by:jinn_hnnl
ID: 22796001
For firefox any another browser, the only way you can do it is using javascript to set the selected file location somewhere (in hiddenfield) and then refer to it when the server is posted back

<asp:FileUpload ID="FileUpload1" runat="server" />

In Page_Load
FileUpload1.Attributes.Add("onchange", "SetFileLocation()");

SetFileLocation is the javascript file where you take the location and set it in the hidden field

Hope this give you some idea

JINN
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question