Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > FileUpload Control

Reply
Thread Tools

FileUpload Control

 
 
bsm
Guest
Posts: n/a
 
      05-02-2007
Hi,

I want to Set asp:fileupload Filename at runtime. When I try to do, it
shows "Readonly" error. Anyway to achieve this.

 
Reply With Quote
 
 
 
 
Aidy
Guest
Posts: n/a
 
      05-02-2007
> I want to Set asp:fileupload Filename at runtime.

You can't for security reasons.


 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      05-02-2007
"bsm" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...

> I want to Set asp:fileupload Filename at runtime. When I try to do, it
> shows "Readonly" error. Anyway to achieve this.


Absolutely not, for fairly obvious security reasons!

Imagine a public website with a hidden FileUpload control which uploaded
people's accounts database, or their Windows password file...

--
http://www.markrae.net

 
Reply With Quote
 
=?Utf-8?B?U2l2YSBN?=
Guest
Posts: n/a
 
      05-02-2007
It is a read-only property and is automatically set by the ASP.NET runtime
when the user posts back the page with uploaded file from the browser.

"bsm" wrote:

> Hi,
>
> I want to Set asp:fileupload Filename at runtime. When I try to do, it
> shows "Readonly" error. Anyway to achieve this.
>
>

 
Reply With Quote
 
bsm
Guest
Posts: n/a
 
      05-02-2007
On May 2, 3:43 pm, "Mark Rae" <(E-Mail Removed)> wrote:
> "bsm" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) ups.com...
>
> > I want to Set asp:fileupload Filename at runtime. When I try to do, it
> > shows "Readonly" error. Anyway to achieve this.

>
> Absolutely not, for fairly obvious security reasons!
>
> Imagine a public website with a hidden FileUpload control which uploaded
> people's accounts database, or their Windows password file...
>
> --http://www.markrae.net


Actually My requirement was-
I have a File Upload control and one DropDownControl. I set
AutoPostBack is true to my DDL. After choosing Filecontrol, if i
change DDL value. The filename has got reset. which our users don't
like this. Do u have any alternate?

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      05-02-2007
"bsm" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...

> The filename has got reset.


That's right - the filename won't survive the postback...

> Do u have any alternate?


No.


--
http://www.markrae.net

 
Reply With Quote
 
bsm
Guest
Posts: n/a
 
      05-02-2007
On May 2, 4:31 pm, "Mark Rae" <(E-Mail Removed)> wrote:
> "bsm" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) oups.com...
>
> > The filename has got reset.

>
> That's right - the filename won't survive the postback...
>
> > Do u have any alternate?

>
> No.
>
> --http://www.markrae.net


Thanks for ur immediate support.

 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      05-03-2007
A FileUpload will not retain its' value between postbacks for security
reasons. Therefore, as long as the ListBox doesn't post back, you won't have
a problem.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"bsm" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> On May 2, 3:43 pm, "Mark Rae" <(E-Mail Removed)> wrote:
>> "bsm" <(E-Mail Removed)> wrote in message
>>
>> news:(E-Mail Removed) ups.com...
>>
>> > I want to Set asp:fileupload Filename at runtime. When I try to do, it
>> > shows "Readonly" error. Anyway to achieve this.

>>
>> Absolutely not, for fairly obvious security reasons!
>>
>> Imagine a public website with a hidden FileUpload control which uploaded
>> people's accounts database, or their Windows password file...
>>
>> --http://www.markrae.net

>
> Actually My requirement was-
> I have a File Upload control and one DropDownControl. I set
> AutoPostBack is true to my DDL. After choosing Filecontrol, if i
> change DDL value. The filename has got reset. which our users don't
> like this. Do u have any alternate?
>



 
Reply With Quote
 
bsm
Guest
Posts: n/a
 
      05-04-2007
On May 3, 3:23 pm, "Kevin Spencer" <(E-Mail Removed)> wrote:
> A FileUpload will not retain its' value between postbacks for security
> reasons. Therefore, as long as the ListBox doesn't post back, you won't have
> a problem.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
>
> Printing Components, Email Components,
> FTP Client Classes, Enhanced Data Controls, much more.
> DSI PrintManager, Miradyne Component Libraries:http://www.miradyne.net
>
> "bsm" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) oups.com...
>
>
>
> > On May 2, 3:43 pm, "Mark Rae" <(E-Mail Removed)> wrote:
> >> "bsm" <(E-Mail Removed)> wrote in message

>
> >>news:(E-Mail Removed) roups.com...

>
> >> > I want to Set asp:fileupload Filename at runtime. When I try to do, it
> >> > shows "Readonly" error. Anyway to achieve this.

>
> >> Absolutely not, for fairly obvious security reasons!

>
> >> Imagine a public website with a hidden FileUpload control which uploaded
> >> people's accounts database, or their Windows password file...

>
> >> --http://www.markrae.net

>
> > Actually My requirement was-
> > I have a File Upload control and one DropDownControl. I set
> > AutoPostBack is true to my DDL. After choosing Filecontrol, if i
> > change DDL value. The filename has got reset. which our users don't
> > like this. Do u have any alternate?- Hide quoted text -

>
> - Show quoted text -


Thanks for the information.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FileUpload control. Eric ASP .Net 4 11-03-2009 11:45 AM
Selecting a date with the Calendar control clears the FileUpload control Nathan Sokalski ASP .Net 1 01-11-2007 06:47 AM
Selecting a date with the Calendar control clears the FileUpload control Nathan Sokalski ASP .Net Web Controls 0 01-11-2007 05:13 AM
FileUpload Control & Image Control eamon ASP .Net Web Controls 2 08-04-2005 07:04 PM
ASP.NET 2.0 FileUpload control Uncle Ben ASP .Net 5 03-23-2005 06:42 PM



Advertisments