Solved

FileUpload

Posted on 2008-10-24
2
298 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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now