SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot sajjad's Avatar
    Join Date
    May 2005
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    File Extension Check

    Hi there,
    I would need javascript code to check extension of uploaded file.
    File upload in not mandatory, but I need script to check extension and allow only JPG, BMP, PGN and other Image files.

    Thank you all

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    This is really something that should be done through server side validation. Mainly the reason is that not only do you have to check for file extension types, but then you have to make sure the files are actually what they say they are (and not, say, random javascript or something).

  3. #3
    SitePoint Zealot sajjad's Avatar
    Join Date
    May 2005
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First i would like to thanx for ur reply but i just want to control it on client side

  4. #4
    Guru Meditation Error gnarly's Avatar
    Join Date
    Dec 2003
    Location
    Cheltenham, United Kingdom
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Chris is right, this is a job for the server side. If you only check on the client side, you switch off JS and voila! You can upload whatever you like.
    Olly Hodgson
    thinkdrastic.net


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •