I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to
submit files. Before the file is successfully submitted I validate another
field on the form, it is the description of the file must be 500 characters.
I am adding the file to a site server library programmaticall y so if the
field is too long I want to return the user to the form with file still
selected in the HtmlInputFile control. I am using an error label to inform
the user to shorten the description. I do not want the user to have to
browse again to the same file after he has shortened the description. Right
now the file does not upload but the control is empty. ASP.NET does not let
me programmaticall y put the full filename and path back into the Value
property of the HtmlInputFile control. How can I do this? I have version
asp.net 1.1
If there is a better thread to post this in please tell me where. I have
searched on Google and cannot find anything. Can I “override” the value
property to add the set? Please help. Cindy
--
cindy 7 1619
I found this but I don't know enough where to start
.............
these controls do not save their viewstate. LoadPostData always returns
false, and the Value property is readonly. You can inherit from the class and
override LoadPostData to return true and try to restore the value, but value
is readonly.
Example to inherit from HtmlInputFile class and override LoadPostData to
return true I am using C# and this is challenging me bad. cindy
"cindy" wrote: I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to submit files. Before the file is successfully submitted I validate another field on the form, it is the description of the file must be 500 characters. I am adding the file to a site server library programmaticall y so if the field is too long I want to return the user to the form with file still selected in the HtmlInputFile control. I am using an error label to inform the user to shorten the description. I do not want the user to have to browse again to the same file after he has shortened the description. Right now the file does not upload but the control is empty. ASP.NET does not let me programmaticall y put the full filename and path back into the Value property of the HtmlInputFile control. How can I do this? I have version asp.net 1.1 If there is a better thread to post this in please tell me where. I have searched on Google and cannot find anything. Can I “override” the value property to add the set? Please help. Cindy
-- cindy
This looks like a security issue here. you are not allowed to do this.
What happens if I pre-populate your email address book or some important
file on your machine and upload it.
Other options may be an activex, java, or .NET control. again they must be
trusted.
Sa
"cindy" <cm****@nospam. nospam> wrote in message
news:F2******** *************** ***********@mic rosoft.com... I found this but I don't know enough where to start ............ these controls do not save their viewstate. LoadPostData always returns false, and the Value property is readonly. You can inherit from the class and override LoadPostData to return true and try to restore the value, but value is readonly.
Example to inherit from HtmlInputFile class and override LoadPostData to return true I am using C# and this is challenging me bad. cindy
"cindy" wrote:
I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to submit files. Before the file is successfully submitted I validate another field on the form, it is the description of the file must be 500 characters. I am adding the file to a site server library programmaticall y so if the field is too long I want to return the user to the form with file still selected in the HtmlInputFile control. I am using an error label to inform the user to shorten the description. I do not want the user to have to browse again to the same file after he has shortened the description. Right now the file does not upload but the control is empty. ASP.NET does not let me programmaticall y put the full filename and path back into the Value property of the HtmlInputFile control. How can I do this? I have version asp.net 1.1 If there is a better thread to post this in please tell me where. I have searched on Google and cannot find anything. Can I "override" the value property to add the set? Please help. Cindy
-- cindy
no not security violation I just want to reload original file so user does
not have to reselect to try upload again. I do not want to change readonly
of the value just the default behavior of LoadPostData to return false--
cindy
"msdn" wrote: This looks like a security issue here. you are not allowed to do this. What happens if I pre-populate your email address book or some important file on your machine and upload it. Other options may be an activex, java, or .NET control. again they must be trusted.
Sa
"cindy" <cm****@nospam. nospam> wrote in message news:F2******** *************** ***********@mic rosoft.com...I found this but I don't know enough where to start ............ these controls do not save their viewstate. LoadPostData always returns false, and the Value property is readonly. You can inherit from the class and override LoadPostData to return true and try to restore the value, but value is readonly.
Example to inherit from HtmlInputFile class and override LoadPostData to return true I am using C# and this is challenging me bad. cindy
"cindy" wrote:
I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to submit files. Before the file is successfully submitted I validate another field on the form, it is the description of the file must be 500 characters. I am adding the file to a site server library programmaticall y so if the field is too long I want to return the user to the form with file still selected in the HtmlInputFile control. I am using an error label to inform the user to shorten the description. I do not want the user to have to browse again to the same file after he has shortened the description. Right now the file does not upload but the control is empty. ASP.NET does not let me programmaticall y put the full filename and path back into the Value property of the HtmlInputFile control. How can I do this? I have version asp.net 1.1 If there is a better thread to post this in please tell me where. I have searched on Google and cannot find anything. Can I "override" the value property to add the set? Please help. Cindy
-- cindy
If you can populate the File-Path then what prevents somebody else from
putting what ever they want in it and upload any file from the client
machine.
The limitations on the HtmlInputFile are for security reasons and by design,
You should punish the user for not following the rules and ask them to
select the file again. I know this is a hassle but life if tuff.
If you find a solution please let us know.
Otherwise deal with it using ActiveX, Java Applet, or DotNet Compontents
that need security permissions anyway to run on the client side.
I like to see the hack.
Sa
"cindy" <cm****@nospam. nospam> wrote in message
news:F0******** *************** ***********@mic rosoft.com... no not security violation I just want to reload original file so user does not have to reselect to try upload again. I do not want to change readonly of the value just the default behavior of LoadPostData to return false-- cindy
"msdn" wrote:
This looks like a security issue here. you are not allowed to do this. What happens if I pre-populate your email address book or some important file on your machine and upload it. Other options may be an activex, java, or .NET control. again they must be trusted.
Sa
"cindy" <cm****@nospam. nospam> wrote in message news:F2******** *************** ***********@mic rosoft.com... >I found this but I don't know enough where to start > ............ > these controls do not save their viewstate. LoadPostData always returns > false, and the Value property is readonly. You can inherit from the > class > and > override LoadPostData to return true and try to restore the value, but > value > is readonly. > > Example to inherit from HtmlInputFile class and override LoadPostData > to > return true I am using C# and this is challenging me bad. cindy > > > "cindy" wrote: > >> I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use >> to >> submit files. Before the file is successfully submitted I validate >> another >> field on the form, it is the description of the file must be 500 >> characters. >> I am adding the file to a site server library programmaticall y so if >> the >> field is too long I want to return the user to the form with file >> still >> selected in the HtmlInputFile control. I am using an error label to >> inform >> the user to shorten the description. I do not want the user to have >> to >> browse again to the same file after he has shortened the description. >> Right >> now the file does not upload but the control is empty. ASP.NET does >> not >> let >> me programmaticall y put the full filename and path back into the Value >> property of the HtmlInputFile control. How can I do this? I have >> version >> asp.net 1.1 >> If there is a better thread to post this in please tell me where. I >> have >> searched on Google and cannot find anything. Can I "override" the >> value >> property to add the set? Please help. Cindy >> >> -- >> cindy
One thought comes to mind,
Why not keep the file that has been uploaded already in a temporary place
and just get back from the user the shortened description.
Tell them you must shorten your description. After the description
satisfies the max length then you deal with the tempsaved file.
use a GUID or something to keep tack of the files and descriptions and
expire them also.
Sa
"msdn" <sq**********@h otmail.com> wrote in message
news:%2******** **********@TK2M SFTNGP02.phx.gb l... If you can populate the File-Path then what prevents somebody else from putting what ever they want in it and upload any file from the client machine. The limitations on the HtmlInputFile are for security reasons and by design,
You should punish the user for not following the rules and ask them to select the file again. I know this is a hassle but life if tuff. If you find a solution please let us know.
Otherwise deal with it using ActiveX, Java Applet, or DotNet Compontents that need security permissions anyway to run on the client side.
I like to see the hack.
Sa
"cindy" <cm****@nospam. nospam> wrote in message news:F0******** *************** ***********@mic rosoft.com... no not security violation I just want to reload original file so user does not have to reselect to try upload again. I do not want to change readonly of the value just the default behavior of LoadPostData to return false-- cindy
"msdn" wrote:
This looks like a security issue here. you are not allowed to do this. What happens if I pre-populate your email address book or some important file on your machine and upload it. Other options may be an activex, java, or .NET control. again they must be trusted.
Sa
"cindy" <cm****@nospam. nospam> wrote in message news:F2******** *************** ***********@mic rosoft.com... >I found this but I don't know enough where to start > ............ > these controls do not save their viewstate. LoadPostData always > returns > false, and the Value property is readonly. You can inherit from the > class > and > override LoadPostData to return true and try to restore the value, but > value > is readonly. > > Example to inherit from HtmlInputFile class and override LoadPostData > to > return true I am using C# and this is challenging me bad. cindy > > > "cindy" wrote: > >> I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use >> to >> submit files. Before the file is successfully submitted I validate >> another >> field on the form, it is the description of the file must be 500 >> characters. >> I am adding the file to a site server library programmaticall y so if >> the >> field is too long I want to return the user to the form with file >> still >> selected in the HtmlInputFile control. I am using an error label to >> inform >> the user to shorten the description. I do not want the user to have >> to >> browse again to the same file after he has shortened the description. >> Right >> now the file does not upload but the control is empty. ASP.NET does >> not >> let >> me programmaticall y put the full filename and path back into the >> Value >> property of the HtmlInputFile control. How can I do this? I have >> version >> asp.net 1.1 >> If there is a better thread to post this in please tell me where. I >> have >> searched on Google and cannot find anything. Can I "override" the >> value >> property to add the set? Please help. Cindy >> >> -- >> cindy
Hi cindy,
Thank you for post.
The HtmlInputFile's content will be automatically cleared when the page is
posted. It's one of the controls that will not preserve values. And yes
it's due to security reason and by design.
Besides other community members' suggestions, I think you can check the
description field length in javascript before submitting the form, thus not
causing a postback.
Regards,
Walter Wang
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.
Walter, Good point.
Sa
"Walter Wang [MSFT]" <wa****@online. microsoft.com> wrote in message
news:gl******** ******@TK2MSFTN GXA01.phx.gbl.. . Hi cindy,
Thank you for post.
The HtmlInputFile's content will be automatically cleared when the page is posted. It's one of the controls that will not preserve values. And yes it's due to security reason and by design.
Besides other community members' suggestions, I think you can check the description field length in javascript before submitting the form, thus not causing a postback.
Regards, Walter Wang 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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Al Smith |
last post by:
Newbee to aspx needs direction.
We are using an <INPUT type="file" tag to upload a file. We also have a
text field for the user to enter a description for the file which the user
must enter. Server side validation was being done for the description field
having length and if not an appropriate message was written back to the
client. However, in the process, the filename the user enters is not
persisted between server calls...
|
by: Ariel Dolan |
last post by:
Can I use HtmlInputFile to only get the selected file name but not actually
upload the file?
Clicking the control's Browse button let's the user select a file. All I
need is the HtmlInputFile Value property. However, any button clicked on the
Html page results in uploading the selected file. Is there a way to avoid
the actual uploading?
Alternatively, is there any other way to let a user select a file name from
his local disk?
|
by: Grant Harmeyer |
last post by:
I have an application that uses FreeTextBox 2.0
(http://www.freetextbox.com). FreeTextBox is a rich text editor that behaves
similarly to MS Word. The FreeTextBox control has a button to insert images
(just as you would with MS Word) and it works beautifully. The problem is
that when you include an image with the rich text editor, the image path is
the local path on the client. I have written a method that examines the text
for <img> tags,...
|
by: Chris |
last post by:
I'm uploading files to a location on my server. It works fine accept, I can't
seem to get the control over the max file size to upload and the types I want
to only allow.
Max file size = 50KB
Types = .gif and .jpg
I've tried using the accept property but it doesn't work, the dialog opens
asking for *.* all files and allows them to be uploaded. And I can't restrict
file size?
|
by: Buddy Ackerman |
last post by:
I created this class
Public Class HTMLFileInput : Inherits System.Web.UI.HtmlControls.HtmlInputFile
Public Property Data As String
Get
Return ViewState("HTMLFileInput.Data")
End Get
Set (ByVal Value As String)
| |
by: Larry O via DotNetMonster.com |
last post by:
Hi - I'm a newbie to .NET and I was hoping someone would be so kind as to
help me out with a question?
Specifiec in my .aspx file: <input type="file" size="50" id="FileToSend"
runat="server" NAME="FileToSend"> and in my class as: protected System.Web.UI.
HtmlControls.HtmlInputFile FileToSend;
When the user clicks the Browse... button, chooses a file and clicks Open,
I'd like to be able to "intercept" the File before it is displayed in...
|
by: ian |
last post by:
Hello,
I have a small test.aspx page with an HtmlInputFile class instance and
an imagebutton. When I run this on our proxy server and click the save
imagebutton I get the "Page cannot be displayed" error screen.
I'm not sure how to fix this because it doesn't happen all the time.
The weird thing is that if I make it a button instead of an image it
works fine. OR if I delete the image (/images/save.jpg) then it works
also.
It doesn't...
|
by: matt |
last post by:
hello,
i have a datagrid w/ a TemplateColumn in it, like so:
<asp:TemplateColumn HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkSelected" Runat="server"/>
</ItemTemplate>
</asp:TemplateColumn>
|
by: Nathan Sokalski |
last post by:
I have a System.Web.UI.HtmlControls.HtmlInputFile control that I use to
submit files. After the file is successfully submitted, I want the field to
be reset so that the user knows the file was submitted. However, ASP.NET
does not let you change the Value property of an HtmlInputFile control. How
can I reset the HtmlInputFile control to it's original state? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |