Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That Javascript code won't work with multiple instances because it uses the <code>getElementById</code> method which returns only one element (the first match it finds). </p> <p>It's also worth mentioning that the JS code won't work for many users (about half, I believe) because it relies on the File API which isn't supported by IE9 and below.</p> <p>To make that code work with multiple instances, it must be either refactored so as not to rely on element IDs, or you must generate multiple copies with unique elment IDs with the server side code. In PHP, that would involve using a <code>for</code> or <code>foreach</code> loop similar to this:</p> <pre><code>&lt;?php for (i=0; $i&lt;$something; i++) { echo &lt;&lt;&lt;EOB var holder = document.getElementById('holder$i'), tests = { filereader: typeof FileReader != 'undefined', dnd: 'draggable' in document.createElement('span'), formdata: !!window.FormData, progress: "upload" in new XMLHttpRequest }, support = { filereader: document.getElementById('filereader$i'), formdata: document.getElementById('formdata$i'), progress: document.getElementById('progress$i') }, // snipped for space EOB; } </code></pre> <p>I don't recommend either course of action, primarily because it still won't work at all with a large number of users. Instead, I suggest using a different upload library.</p> <p>I've been similarly dissatisfied with JS file upload libraries, so I wrote one that supports IE7+ (theoretically IE6, but not tested), progress bars (with fallback options for handling IE9 and below), and allows multiple instances.</p> <p>It does not, however, support drag and drop uploading, so if that's a requirement, it won't suit your needs. For what it's worth, here it is (link to live demo at the top):</p> <p><a href="https://github.com/LPology/Simple-Ajax-Uploader" rel="nofollow">https://github.com/LPology/Simple-Ajax-Uploader</a></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. This table or related slice is empty.
    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