473,386 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

FileUpload PostedFile after Postback question

My environment is ASP.NET 2.0, C# and AJAX.

Is there a way to retain the Postedfile in the FileUpload control
after Postback? I have this application I've inherited were the User
chooses a file then clicks the "save" button, the program proceeds to
edit the file on the server and if it detects an error displays an
error message. At this point the filename is lost from the FileUpload
input field.

Sal P.

Jun 5 '07 #1
2 11371
It is 'by design', for security reasons. The idea is that users should know
and explicitly select a file for upload. Hence cannot be retained across
postbacks.

"ro****@gmail.com" wrote:
My environment is ASP.NET 2.0, C# and AJAX.

Is there a way to retain the Postedfile in the FileUpload control
after Postback? I have this application I've inherited were the User
chooses a file then clicks the "save" button, the program proceeds to
edit the file on the server and if it detects an error displays an
error message. At this point the filename is lost from the FileUpload
input field.

Sal P.

Jun 5 '07 #2
Actually the FileUpload retains its state just fine after
postback...it only gets null'ed when dropped into an AJAX panel, when
the panel is removed it retains its state again even after
postback...so I have doubts that it is a question of security.
On Jun 5, 5:07 am, Siva M <shiva...@online.excite.comwrote:
It is 'by design', for security reasons. The idea is that users should know
and explicitly select a file for upload. Hence cannot be retained across
postbacks.

"ron...@gmail.com" wrote:
My environment is ASP.NET 2.0, C# andAJAX.
Is there a way to retain thePostedfilein the FileUpload control
afterPostback? I have this application I've inherited were the User
chooses a file then clicks the "save" button, the program proceeds to
edit the file on the server and if it detects an error displays an
error message. At this point the filename is lost from the FileUpload
input field.
Sal P.- Hide quoted text -

- Show quoted text -

Jun 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: narmathabala | last post by:
Hello, I need to insert BLOB into MySQL DB from a C#.NET 2.0 environment. The piece of code which I am using is listed below. Note: fileup is a FileUpload holder <code> Stream content =...
12
by: Phil Z. | last post by:
After migrating an ASP.NET 1.1 application to 2.0 we were getting "Cannot access a closed file" errors when uploading. I found a number of post on the subject and have since moved from using an...
0
by: Christian Schlemmer | last post by:
If my code will run into the filesize-limit condition, the INSERT-statement will be executed. is there a way to avoid that? Protected Sub DetailsView1_RowInserting(ByVal sender As Object,...
4
by: Dave | last post by:
If you had a FileUpload control inside of a FormView...how would you use FindControl to access the FileUpload properties? Let me just say that...
2
by: Qweertz | last post by:
I'm trying to send e-mail with attachment that I take from FileUpload control. The problem is how to get full path of file. For instance when I have file "C:\test.txt"...
4
by: ronc85 | last post by:
I'm using ASP.NET 2.0 and C#. With the FileUpload control is it possible to set Wildcards (e.g., *.xls and *.doc) so that when the user clicks the Browse button it defaults to Excel and/or Word...
4
by: Mukesh | last post by:
i have coded like this <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server"> <asp:FileUpload ID="fupLogo" runat="server"...
0
by: thupham | last post by:
I use Visual Studio 2003, and Ajax.dll In design, I have : 1 FileField, named: FileInput, set runnat="server" 1 Button (of Html toolbox), named: cmdUpload 1 Label (of HTML...
9
by: vital | last post by:
Hi, I have a User control which has a fileupload control. With the requirements I placed the user control in a UpdatePanel of ASP.NET Ajax and the fileupload.postedfile.filename giving error. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.