How do I show the user only jpeg files when browsing

Discussion in 'HTML' started by Ron Brennan, Sep 6, 2004.

  1. Ron Brennan

    Ron Brennan Guest

    Good afternoon.

    I am trying to have the input element show only jpeg files when the user
    browses his directories to choose an image to upload. This is what I think
    should work but doesn't, at least for me using IE 5.0. Anyone out there that
    can offer a possible solution?

    <form action="myuploadservlet" method="post" enctype="multipart/form-data">
    ....
    <input type="file" name="pic" accept="image/jpg,jpeg">

    Thanks,
    Ron.
     
    Ron Brennan, Sep 6, 2004
    #1
    1. Advertisements

  2. That says that you'll accept the non-existant MIME types "image/jpg" and
    "jpeg". You'll want to use accept="image/jpeg"; don't worry about the
    file's extension. Unfortunately, though, there's virtually no browser
    support for that attribute.
     
    Leif K-Brooks, Sep 6, 2004
    #2
    1. Advertisements

  3. Ron Brennan

    Ron Brennan Guest

    I gained three pieces of information from you: 1) the image/jpg,jpeg syntax
    is invalid 2) a correct MIME type will accept both extensions 3) virtually
    no browser support for the attribute.

    Much appreciated; thank you.

    Ron.
     
    Ron Brennan, Sep 6, 2004
    #3
  4. The syntax itself isn't invalid; it's valid syntax for saying "files of
    the MIME types 'image/jpg' and 'jpeg'." It's just that neither of those
    MIME types actually exist; a browser which supported the "accept"
    attribute wouldn't display any files.

    I'm guessing you meant to say "files of the MIME types 'image/jpg' and
    'image/jpeg'." The correct syntax for that would be
    "image/jpg,image/jpeg", although there's no reason to include the
    "image/jpg".
     
    Leif K-Brooks, Sep 6, 2004
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.