Re: Change "File of Type" in the Browse File dialog box.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Alessandro Zifiglio (alessandrozifiglio_at_NO-SPAM-hotmail.com)
Date: 02/12/04


Date: Thu, 12 Feb 2004 11:06:05 +0100

Jen, much clearer now. You cannot control through server side code, you can
check what files are being uploaded and limit option to disallow this with
an error message showing wrong file name. But this is not what you want.
What your saying is you want to filter out file types for you input file
element. This is possible by using the accept attribute for your input file
element and supplying it a list of files you want to accept.
Sample :
<input type="file" name="uploaded_file" accept="image/png, image/gif" />

Examples of content types include "text/html", "image/png", "image/gif",
"video/mpeg", "audio/basic", "text/tcl", "text/javascript", and
"text/vbscript". For the current list of registered Multipurpose Internet
Mail Extensions (MIME) types, see
http://www.w3.org/TR/1998/REC-html40-19980424/references.html#ref-MIMETYPES

On a side note : Always use the enctype of "multi-part/form-data" on the
form, otherwise the files will not upload correctly

"Jen" <freesiajen@hotmail.com> wrote in message
news:E7A05725-9F44-4E34-96A4-6CE14E8239B9@microsoft.com...
> Hi Alessandro,
>
> Thank you for your help. But I am a newbie in aspnet and C#. Pardon me,
if I sound silly.
> First of all, my development environment is asp.net for web. The codes
you provide me with seems to be meant for window base (I really don't know
how to apply it). Therefore, I didn't manage to get it working. I am using
"file field" with the default "browse" button.
>
> Regards,
> Jen
>
>



Relevant Pages

  • Re: [WEB SECURITY] [Web Security] File Upload Virus Scanning
    ... First I had to gather a list of all file formats the business intentionally wanted uploaded. ... couldn't upload files with other extensions. ... Step 2: Verify allowed file types ...
    (Security-Basics)
  • Re: [WEB SECURITY] [Web Security] File Upload Virus Scanning
    ... [WEB SECURITY] File Upload Virus Scanning ... Step 2: Verify allowed file types ... be executed in your browser as HTML. ...
    (Security-Basics)
  • Re: Upload a file and modify its atributes generates two versions
    ... the properties of the file before upload it to the SPSv2, ... does not generate two versions, but only works with Office file types, if ... > SPS2003 and modifying its atributes. ... one the the uploaded document and the other wtih the new ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: .exe uplpoads
    ... You can use URLScan to disallow .EXE from being accepted by the server on ... upload of one file extension but not another. ...
    (microsoft.public.inetserver.iis)
  • Re: Opening in unwanted programs
    ... Choose Folder Options. ... Choose "File Types". ... Whenever I double click on a picture> it uploads in a program I don't want it to upload in. ... Is there anyway to change from one program to another,> so that when I double click on a picture it'll upload in> the right program? ...
    (microsoft.public.windowsxp.accessibility)