|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
HtmlInputFile during postback..Hi
In the webform, if a use selects a file to upload and submits the form. But if page validation fails, the HtmlInputFile loses the filename string and the user has to re-select the file using the browse button. Is there any way to persist the postedFile.filename during postback? Appreciate any help. The value in a <input type=file> is not allowed to be set by the page. The
browser always sets it to blank by default. This is for security, as malicious websites could seed the control with a path to sensitive data on your machine. -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > Hi > > In the webform, if a use selects a file to upload and submits the > form. But if page validation fails, the HtmlInputFile loses the > filename string and the user has to re-select the file using the > browse button. > > Is there any way to persist the postedFile.filename during postback? > > Appreciate any help. > Can I use client-side validation ? would the browser retain the value in the
<input type=file> control? Show quoteHide quote "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message news:297019632477094716145888@msnews.microsoft.com... > The value in a <input type=file> is not allowed to be set by the page. The > browser always sets it to blank by default. This is for security, as malicious > websites could seed the control with a path to sensitive data on your machine. > > -Brock > DevelopMentor > http://staff.develop.com/ballen > > > > > Hi > > > > In the webform, if a use selects a file to upload and submits the > > form. But if page validation fails, the HtmlInputFile loses the > > filename string and the user has to re-select the file using the > > browse button. > > > > Is there any way to persist the postedFile.filename during postback? > > > > Appreciate any help. > > > > > I've not tried too hard to make this work, but I don't even think client
side script allows you to set the value of the file input. Again, it's a security risk, so hopefully this won't work for you. Sorry. ;) -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > Can I use client-side validation ? would the browser retain the value > in the <input type=file> control? > > "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message > news:297019632477094716145888@msnews.microsoft.com... > >> The value in a <input type=file> is not allowed to be set by the >> page. The browser always sets it to blank by default. This is for >> security, as >> > malicious > >> websites could seed the control with a path to sensitive data on your >> > machine. > >> -Brock >> DevelopMentor >> http://staff.develop.com/ballen >>> Hi >>> >>> In the webform, if a use selects a file to upload and submits the >>> form. But if page validation fails, the HtmlInputFile loses the >>> filename string and the user has to re-select the file using the >>> browse button. >>> >>> Is there any way to persist the postedFile.filename during postback? >>> >>> Appreciate any help. >>> Are you inserting the runat="server" attribute within the tag itself?
Show quoteHide quote "newmem" <""> wrote in message news:eqkhfNKNFHA.1948@TK2MSFTNGP14.phx.gbl... > Hi > > In the webform, if a use selects a file to upload and submits the form. > But > if page validation fails, the HtmlInputFile loses the filename string and > the user has to re-select the file using the browse button. > > Is there any way to persist the postedFile.filename during postback? > > Appreciate any help. > > > If you are having trouble with retrieving the name of the posted file, or
the location to the posted file, make sure the form in which this control exists has the enctype="multipart/form-data" as seen below. <form id="DefaultForm" method="post" runat="server" enctype="multipart/form-data"> </form> When you upload your picture, you should be able to access it in your code behind like this. HttpPostedFile file = Request.Files["MyFileUpload"]; where the control is <INPUT name="MyFileUpload"> Hopefully I answered the right question for you. -- Show quoteHide quoteAlex Mueller "newmem" <""> wrote in message news:eqkhfNKNFHA.1948@TK2MSFTNGP14.phx.gbl... > Hi > > In the webform, if a use selects a file to upload and submits the form. But > if page validation fails, the HtmlInputFile loses the filename string and > the user has to re-select the file using the browse button. > > Is there any way to persist the postedFile.filename during postback? > > Appreciate any help. > > >
Stop my window from jumping
Highlight the datalist row Datalist Edit button created in ITemplate class RequiredFieldValidator Question adding a new row to the repeater control Div tag to display/ hide a control ....please help Chart position RadioBNuttonList Problem query database, create control, display on page Trouble Filling DropDownList in Datagrid |
|||||||||||||||||||||||