Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>How can i limit my form to only accept jpeg files</p> </blockquote> <p>Mostly, you can't. You have to check at the server (which you need to do <em>anyway</em>, even if you can check at the client; you can <strong>never</strong> trust client-side validation, of anything). But things are improving. There is the new <a href="http://www.w3.org/TR/file-upload/" rel="nofollow noreferrer">File API from the W3C</a> coming down-the-pike, which you could use on browsers that support it (Mostly Firefox, at the moment; it was a Mozilla initiative), just for a better user experience for those with modern browsers.</p> <p><strong>Edit</strong> And <a href="https://stackoverflow.com/questions/3165934/filetype-in-html-upload-form/3165995#3165995">Gert G points out</a> that here's the <a href="http://www.w3.org/TR/html5/number-state.html#attr-input-accept" rel="nofollow noreferrer"><code>accept</code> attribute</a> that can give a hint to the browser, which is nice for browsers that support it.</p> <blockquote> <p>And are there any javascript method to show progress?</p> </blockquote> <p>Not directly, no. It's sometimes possible to show progress indirectly, by using a timed series of ajax requests alongside the upload and having the server tell you how much it had received so far, but it's fraught with difficulty and probably not worth the bother.</p> <p>This is another area where the file API could help, although you might find you introduced a fair bit of latency in the process: Basically, you could read a chunk of the file locally, send that to the server via ajax, update progress, read and send the next chunk, etc.</p> <p>There are, of course, Flash uploaders like <a href="http://www.swfupload.org/" rel="nofollow noreferrer">SWFUpload</a> that show progress and such, if you want to use something proprietary (but incredibly widespread). (Flash, I mean.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload