|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to filter file types when using the HTMLInputFile control...On my Web Servers, I don't want to allow visitors to upload executables.
There are many types of files that i want to ignore (for instance: exe,dll, bat, cmd .etc). I have an ASPX page with an HTMLInputFile control which uploads the files. Is it possible to set a filter when the user clicks the Browse button so that the file selection dialog only displays valid formats specified. thankx in advance Asela Gunawardena. You could maintain a list of acceptable file types in a collection and then
loop through this collection checking it against the file being uploaded. You would need to use some VB.NET code like this: fileExtension = Mid(fileName, InStrRev(fileName, ".") + 1) To figure out the file extension of the uploaded file. Show quoteHide quote "Asela Gunawardena" wrote: > On my Web Servers, I don't want to allow visitors to upload executables. > There are many types of files that i want to ignore (for instance: exe,dll, > bat, cmd .etc). I have an ASPX page with an HTMLInputFile control which > uploads the files. Is it possible to set a filter when the user clicks the > Browse button so that the > file selection dialog only displays valid formats specified. > > thankx in advance > > Asela Gunawardena. > > > thankx, but this of course i do check. what i would like to know is whether
there is a way of restricting the user select the unnessary formats when the file dialog appears; making only the relavant types appear. Show quoteHide quote "dbottjer" <dbott***@discussions.microsoft.com> wrote in message news:B03045D1-F7E0-440F-B744-27B896C40539@microsoft.com... > You could maintain a list of acceptable file types in a collection and > then > loop through this collection checking it against the file being uploaded. > You would need to use some VB.NET code like this: > > fileExtension = Mid(fileName, InStrRev(fileName, ".") + 1) > > To figure out the file extension of the uploaded file. > > "Asela Gunawardena" wrote: > >> On my Web Servers, I don't want to allow visitors to upload executables. >> There are many types of files that i want to ignore (for instance: >> exe,dll, >> bat, cmd .etc). I have an ASPX page with an HTMLInputFile control which >> uploads the files. Is it possible to set a filter when the user clicks >> the >> Browse button so that the >> file selection dialog only displays valid formats specified. >> >> thankx in advance >> >> Asela Gunawardena. >> >> >>
Bound dropdownlist in .NET 2.0 -- picking the selected value?
masterpages: body event handler <customErrors mode="Off"/> ERROR How to reference the masterpage body element in server code Walking thr DataReader Repeater.Itemcommand not firing master-pages: naming problem for client-side scripting referencing and anchor from within a usercontrol (ascx) referencing and anchor from within a usercontrol (ascx) Can RDLC Reports be used with Oracle data sources? |
|||||||||||||||||||||||