Solved

FileUpload

Posted on 2008-10-24
2
299 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

773 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