|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
FileUpload control - file size detectionIs it possible to obtain the file size at the moment when the file path/name
populates the textbox portion of the FileUpload control? Thx The HTML markup to do file upload is the INPUT element with "file" set
as the TYPE. You can read the specifications on it here. http://www.w3.org/TR/html4/interact/forms.html Unfortunately it does not support a file size limit with an attribute on that markup element. That would be an obvious feature, but perhaps it is not allowed due to security concerns although the size should be a safe value to expose to an untrusted website. This is touchy because it is one of the few features of a web browser which gives you access to the user's file system. I just browsed a site I use which has an upload features and used Firefox's Firebug add-on to browse the DOM for the upload form and it did not show the size of the file I had selected. If there is a way to limit file size for uploads I would also like to know it. Brennan Stehling http://brennan.offwhite.net/blog/ E. Kwong wrote: Show quoteHide quote > Is it possible to obtain the file size at the moment when the file path/name > populates the textbox portion of the FileUpload control? > > Thx If you have access to the web-site's configuration file, you can limit the
upload size via the Web.config file as follows: <system.web> <httpRuntime maxRequestLength="<max size in KB>"/> </system.web> Mike Ober. Show quoteHide quote "Brennan Stehling" <offwh***@gmail.com> wrote in message news:1162936291.885855.65240@i42g2000cwa.googlegroups.com... > The HTML markup to do file upload is the INPUT element with "file" set > as the TYPE. You can read the specifications on it here. > > http://www.w3.org/TR/html4/interact/forms.html > > Unfortunately it does not support a file size limit with an attribute > on that markup element. That would be an obvious feature, but perhaps > it is not allowed due to security concerns although the size should be > a safe value to expose to an untrusted website. This is touchy because > it is one of the few features of a web browser which gives you access > to the user's file system. > > I just browsed a site I use which has an upload features and used > Firefox's Firebug add-on to browse the DOM for the upload form and it > did not show the size of the file I had selected. > > If there is a way to limit file size for uploads I would also like to > know it. > > Brennan Stehling > http://brennan.offwhite.net/blog/ > > E. Kwong wrote: >> Is it possible to obtain the file size at the moment when the file >> path/name >> populates the textbox portion of the FileUpload control? >> >> Thx > That works but not at the moment the filename is put in the upload box as
the original poster requested. I don't know of any way to meet that requirement other than a thick client such as a windows forms component (with the appropriate permissions) or an ActiveX control. Show quoteHide quote "Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message news:uzh5JS0AHHA.3316@TK2MSFTNGP02.phx.gbl... > If you have access to the web-site's configuration file, you can limit the > upload size via the Web.config file as follows: > > <system.web> > <httpRuntime maxRequestLength="<max size in KB>"/> > </system.web> > > Mike Ober. > > > > "Brennan Stehling" <offwh***@gmail.com> wrote in message > news:1162936291.885855.65240@i42g2000cwa.googlegroups.com... >> The HTML markup to do file upload is the INPUT element with "file" set >> as the TYPE. You can read the specifications on it here. >> >> http://www.w3.org/TR/html4/interact/forms.html >> >> Unfortunately it does not support a file size limit with an attribute >> on that markup element. That would be an obvious feature, but perhaps >> it is not allowed due to security concerns although the size should be >> a safe value to expose to an untrusted website. This is touchy because >> it is one of the few features of a web browser which gives you access >> to the user's file system. >> >> I just browsed a site I use which has an upload features and used >> Firefox's Firebug add-on to browse the DOM for the upload form and it >> did not show the size of the file I had selected. >> >> If there is a way to limit file size for uploads I would also like to >> know it. >> >> Brennan Stehling >> http://brennan.offwhite.net/blog/ >> >> E. Kwong wrote: >>> Is it possible to obtain the file size at the moment when the file >>> path/name >>> populates the textbox portion of the FileUpload control? >>> >>> Thx >> > > Agreed - it doesn't answer OPs original question, but it can at least block
arbitrarily large files from being uploaded, which I suspect was the intent. Mike. Show quoteHide quote "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message news:OhwCwZ2AHHA.1012@TK2MSFTNGP04.phx.gbl... > That works but not at the moment the filename is put in the upload box as > the original poster requested. > > I don't know of any way to meet that requirement other than a thick client > such as a windows forms component (with the appropriate permissions) or an > ActiveX control. > > -- > I hope this helps, > Steve C. Orr > MCSD, MVP, CSM > http://SteveOrr.net > > > > "Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message > news:uzh5JS0AHHA.3316@TK2MSFTNGP02.phx.gbl... >> If you have access to the web-site's configuration file, you can limit >> the upload size via the Web.config file as follows: >> >> <system.web> >> <httpRuntime maxRequestLength="<max size in KB>"/> >> </system.web> >> >> Mike Ober. >> >> >> >> "Brennan Stehling" <offwh***@gmail.com> wrote in message >> news:1162936291.885855.65240@i42g2000cwa.googlegroups.com... >>> The HTML markup to do file upload is the INPUT element with "file" set >>> as the TYPE. You can read the specifications on it here. >>> >>> http://www.w3.org/TR/html4/interact/forms.html >>> >>> Unfortunately it does not support a file size limit with an attribute >>> on that markup element. That would be an obvious feature, but perhaps >>> it is not allowed due to security concerns although the size should be >>> a safe value to expose to an untrusted website. This is touchy because >>> it is one of the few features of a web browser which gives you access >>> to the user's file system. >>> >>> I just browsed a site I use which has an upload features and used >>> Firefox's Firebug add-on to browse the DOM for the upload form and it >>> did not show the size of the file I had selected. >>> >>> If there is a way to limit file size for uploads I would also like to >>> know it. >>> >>> Brennan Stehling >>> http://brennan.offwhite.net/blog/ >>> >>> E. Kwong wrote: >>>> Is it possible to obtain the file size at the moment when the file >>>> path/name >>>> populates the textbox portion of the FileUpload control? >>>> >>>> Thx >>> >> >> > > This would be an ideal space for a Click-Once application which uploads
files using a desktop application. It could connect to a web service and send 1000kb chunks and monitor the progress for the user. It could even support a stop and resume process. Such functionality is strongly lacking from the web browsers. http://search.msdn.microsoft.com/search/Redirect.aspx?title=ClickOnce+Deployment+Overview+&url=http://msdn2.microsoft.com/en-us/library/142dbbz4.aspx Brennan Stehling http://brennan.offwhite.net/blog/ Michael D. Ober wrote: Show quoteHide quote > Agreed - it doesn't answer OPs original question, but it can at least block > arbitrarily large files from being uploaded, which I suspect was the intent. > > Mike. > > "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message > news:OhwCwZ2AHHA.1012@TK2MSFTNGP04.phx.gbl... > > That works but not at the moment the filename is put in the upload box as > > the original poster requested. > > > > I don't know of any way to meet that requirement other than a thick client > > such as a windows forms component (with the appropriate permissions) or an > > ActiveX control. > > > > -- > > I hope this helps, > > Steve C. Orr > > MCSD, MVP, CSM > > http://SteveOrr.net > > > > > > > > "Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message > > news:uzh5JS0AHHA.3316@TK2MSFTNGP02.phx.gbl... > >> If you have access to the web-site's configuration file, you can limit > >> the upload size via the Web.config file as follows: > >> > >> <system.web> > >> <httpRuntime maxRequestLength="<max size in KB>"/> > >> </system.web> > >> > >> Mike Ober. > >> > >> > >> > >> "Brennan Stehling" <offwh***@gmail.com> wrote in message > >> news:1162936291.885855.65240@i42g2000cwa.googlegroups.com... > >>> The HTML markup to do file upload is the INPUT element with "file" set > >>> as the TYPE. You can read the specifications on it here. > >>> > >>> http://www.w3.org/TR/html4/interact/forms.html > >>> > >>> Unfortunately it does not support a file size limit with an attribute > >>> on that markup element. That would be an obvious feature, but perhaps > >>> it is not allowed due to security concerns although the size should be > >>> a safe value to expose to an untrusted website. This is touchy because > >>> it is one of the few features of a web browser which gives you access > >>> to the user's file system. > >>> > >>> I just browsed a site I use which has an upload features and used > >>> Firefox's Firebug add-on to browse the DOM for the upload form and it > >>> did not show the size of the file I had selected. > >>> > >>> If there is a way to limit file size for uploads I would also like to > >>> know it. > >>> > >>> Brennan Stehling > >>> http://brennan.offwhite.net/blog/ > >>> > >>> E. Kwong wrote: > >>>> Is it possible to obtain the file size at the moment when the file > >>>> path/name > >>>> populates the textbox portion of the FileUpload control? > >>>> > >>>> Thx > >>> > >> > >> > > > > Yes I've thought about that but security is the main problem.
By default click once applications don't have much access to the user's hard drive. Show quoteHide quote "Brennan Stehling" <offwh***@gmail.com> wrote in message news:1163173614.588361.189770@h54g2000cwb.googlegroups.com... > This would be an ideal space for a Click-Once application which uploads > files using a desktop application. It could connect to a web service > and send 1000kb chunks and monitor the progress for the user. It could > even support a stop and resume process. > > Such functionality is strongly lacking from the web browsers. > > http://search.msdn.microsoft.com/search/Redirect.aspx?title=ClickOnce+Deployment+Overview+&url=http://msdn2.microsoft.com/en-us/library/142dbbz4.aspx > > Brennan Stehling > http://brennan.offwhite.net/blog/ > > Michael D. Ober wrote: >> Agreed - it doesn't answer OPs original question, but it can at least >> block >> arbitrarily large files from being uploaded, which I suspect was the >> intent. >> >> Mike. >> >> "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message >> news:OhwCwZ2AHHA.1012@TK2MSFTNGP04.phx.gbl... >> > That works but not at the moment the filename is put in the upload box >> > as >> > the original poster requested. >> > >> > I don't know of any way to meet that requirement other than a thick >> > client >> > such as a windows forms component (with the appropriate permissions) or >> > an >> > ActiveX control. >> > >> > -- >> > I hope this helps, >> > Steve C. Orr >> > MCSD, MVP, CSM >> > http://SteveOrr.net >> > >> > >> > >> > "Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message >> > news:uzh5JS0AHHA.3316@TK2MSFTNGP02.phx.gbl... >> >> If you have access to the web-site's configuration file, you can limit >> >> the upload size via the Web.config file as follows: >> >> >> >> <system.web> >> >> <httpRuntime maxRequestLength="<max size in KB>"/> >> >> </system.web> >> >> >> >> Mike Ober. >> >> >> >> >> >> >> >> "Brennan Stehling" <offwh***@gmail.com> wrote in message >> >> news:1162936291.885855.65240@i42g2000cwa.googlegroups.com... >> >>> The HTML markup to do file upload is the INPUT element with "file" >> >>> set >> >>> as the TYPE. You can read the specifications on it here. >> >>> >> >>> http://www.w3.org/TR/html4/interact/forms.html >> >>> >> >>> Unfortunately it does not support a file size limit with an attribute >> >>> on that markup element. That would be an obvious feature, but >> >>> perhaps >> >>> it is not allowed due to security concerns although the size should >> >>> be >> >>> a safe value to expose to an untrusted website. This is touchy >> >>> because >> >>> it is one of the few features of a web browser which gives you access >> >>> to the user's file system. >> >>> >> >>> I just browsed a site I use which has an upload features and used >> >>> Firefox's Firebug add-on to browse the DOM for the upload form and it >> >>> did not show the size of the file I had selected. >> >>> >> >>> If there is a way to limit file size for uploads I would also like to >> >>> know it. >> >>> >> >>> Brennan Stehling >> >>> http://brennan.offwhite.net/blog/ >> >>> >> >>> E. Kwong wrote: >> >>>> Is it possible to obtain the file size at the moment when the file >> >>>> path/name >> >>>> populates the textbox portion of the FileUpload control? >> >>>> >> >>>> Thx >> >>> >> >> >> >> >> > >> > >
GridView multiple DDL
Get value from textbox in webcontrol Javascript from treeview "Failed to load viewstate" when clicking button Paging in DataGrid does not work 2.. FileUpload Control in ASP 2.0. Re: Binding a single object to a control Folder creation error: "Could not find a part of the path" error initialize value - FormView InsertItemTemplate How to become Rich using Net |
|||||||||||||||||||||||