Re: Limiting fileupload file types

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

From: Kevin Spencer (kspencer_at_takempis.com)
Date: 11/29/04


Date: Mon, 29 Nov 2004 13:51:37 -0500

I'm not sure how you'd do this with Frontpage, but I can tell you how it's
done on the client-side using JavaScript. You would want to write a
JavaScript function that checks the "value" attribute of the "input
type=file" form field. It would parse the file path, and starting from the
last "." check the file extension. If it wasn't the correct extension, it
would cause the form validation to return false, preventing the submit of
the form.

-- 
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"ik" <ik@discussions.microsoft.com> wrote in message
news:A65E8D47-41A9-41B3-AE26-4B010F0EBFC4@microsoft.com...
> I'm using FP 2002 fileupload component to allow files to be uploaded to my
> website. Currently site visitors can upload any type of file. I would like
to
> limit the type of files uploaded to say only pictures (*.jpg). Is there a
way
> to do this?
> Thanks in advance for your response.
>


Relevant Pages

  • [Full-disclosure] Geeklog <= v1.6.0sr2 - Remote File Upload
    ... Geeklog <= v1.6.0sr2 - Remote File Upload ... Geeklog has several options to upload images. ... based on file extension. ... Executable javascript can easily be uploaded. ...
    (Full-Disclosure)
  • Re: Upload file size
    ... you will need a client-side app ... (JavaScript, Java Applet, ActiveX Control, etc) ... Is there a way to determine the size of a file in InputFile control ... > more than one upload at a time. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Can not download DWT-files from document libraries
    ... If I try to upload a dll-file, ... It's so frustrating that dwt-files doesn't work in the same way! ... It seems that SPS also blocks the file extension in some way. ...
    (microsoft.public.sharepoint.portalserver)
  • Re: resize image on client side
    ... sent pictures are very huge and I do resize them anyway since I ... Instead of letting people upload the 3MB file then resize it on the ... server, isn't there any possibility to "reduce" the file resolution on ... on the users PC to be able to manipulate images as Javascript itself has ...
    (comp.lang.javascript)
  • RE: [PHP] Re: PHP/AJAX File Drag&Drop
    ... You can also use the FileReference ActionScript class in flash. ... multiple file selection. ... make use of this flash feature to upload multiple files interactively ... Unfortunatly javascript can't access the filesystem so it can't get ...
    (php.general)