RE: FileUpload - keep the filename
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Wed, 22 Mar 2006 10:13:54 GMT
Hi Dave,
As for the fileupload control, it won't persist the filename after the post
in which the file stream is uploaded. This is because the file stream only
exists in the postback of the uploading post, after that , no filestream
exists in the request, so there is no reason to persist the filename any
longer. This also confirm to the html <input type="file" ...> element's
natural behavior. BTW, if you do need to persist the filename(of the
latest uploaded file), you can consider manually store it in the fileupload
control's attributes colleciton for sequential use. For example:
======================
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (fu1.HasFile && fu1.FileName != null)
{
fu1.Attributes["filename"] = fu1.FileName;
}
}
=======================
then, in later postback, we can access the value through
fu1.Attriburtes["filename"]
Hope this helps you.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- Follow-Ups:
- RE: FileUpload - keep the filename
- From: David Thielen
- RE: FileUpload - keep the filename
- Prev by Date: How do change layout od SideBar in Wizard control? (ASP.NET 2.0)
- Next by Date: RE: Bind data to control inside a Repeater
- Previous by thread: How do change layout od SideBar in Wizard control? (ASP.NET 2.0)
- Next by thread: RE: FileUpload - keep the filename
- Index(es):
Relevant Pages
|
Loading