<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Multiple File Upload&#160;Input</title> <atom:link href="http://davidwalsh.name/multiple-file-upload/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/multiple-file-upload</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Wed, 23 May 2012 14:01:31 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: Andrew P.</title><link>http://davidwalsh.name/multiple-file-upload#comment-32159</link> <dc:creator>Andrew P.</dc:creator> <pubDate>Sat, 12 May 2012 12:35:13 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=5010#comment-32159</guid> <description>Ooops.. Below the code:function makeFileListImg() {
var file = document.getElementById(&#039;gallery&#039;).value;
if(navigator.userAgent.indexOf(&#039;Linux&#039;) != -1){
var SO = &quot;Linux&quot;; }
else if((navigator.userAgent.indexOf(&#039;Win&#039;) != -1) &amp;&amp;(navigator.userAgent.indexOf(&#039;95&#039;) != -1)){
var SO = &quot;Win&quot;; }
else if((navigator.userAgent.indexOf(&#039;Win&#039;) != -1) &amp;&amp;(navigator.userAgent.indexOf(&#039;NT&#039;) != -1)){
var SO = &quot;Win&quot;; }
else if(navigator.userAgent.indexOf(&#039;Win&#039;) != -1){
var SO = &quot;Win&quot;; }
else if(navigator.userAgent.indexOf(&#039;Mac&#039;) != -1){
var SO = &quot;Mac&quot;; }
else { var SO = &quot;Undefined&quot;;
}
if(SO = &quot;Win&quot;){
var path = file.split(&quot;\\&quot;);
}else{
var path = file.split(&quot;/&quot;);
}
var name_file = (path[path.length-1]);
var ext_valid = /\.(gif&#124;jpg&#124;png)$/i.test(name_file);
if (!ext_valid){
document.getElementById(&#039;gallery&#039;).innerHTML = &quot;&quot;;
var empty = document.getElementById(&#039;gallery&#039;).value = &quot;&quot;;
alert(&quot;Your file: &quot; + name_file + &quot;, contains a forbidden extension for the gallery. Please make your option again.&quot;);
return false;
}else
{
var input = document.getElementById(&quot;gallery&quot;);
var ul = document.getElementById(&quot;list-gallery&quot;);
while (ul.hasChildNodes()) {
ul.removeChild(ul.firstChild);
}
for (var i = 0; i &lt; input.files.length; i++) {
var li = document.createElement(&quot;li&quot;);
li.innerHTML = input.files[i].name;
ul.appendChild(li);
}
if(!ul.hasChildNodes()) {
var li = document.createElement(&quot;li&quot;);
li.innerHTML = &#039;No Files Selected for Gallery&#039;;
ul.appendChild(li);
}
}
} </description> <content:encoded><![CDATA[<p>Ooops.. Below the code:</p><p> function makeFileListImg() {<br
/> var file = document.getElementById(&#8216;gallery&#8217;).value;<br
/> if(navigator.userAgent.indexOf(&#8216;Linux&#8217;) != -1){<br
/> var SO = &#8220;Linux&#8221;; }<br
/> else if((navigator.userAgent.indexOf(&#8216;Win&#8217;) != -1) &amp;&amp;(navigator.userAgent.indexOf(&#8217;95&#8242;) != -1)){<br
/> var SO = &#8220;Win&#8221;; }<br
/> else if((navigator.userAgent.indexOf(&#8216;Win&#8217;) != -1) &amp;&amp;(navigator.userAgent.indexOf(&#8216;NT&#8217;) != -1)){<br
/> var SO = &#8220;Win&#8221;; }<br
/> else if(navigator.userAgent.indexOf(&#8216;Win&#8217;) != -1){<br
/> var SO = &#8220;Win&#8221;; }<br
/> else if(navigator.userAgent.indexOf(&#8216;Mac&#8217;) != -1){<br
/> var SO = &#8220;Mac&#8221;; }<br
/> else { var SO = &#8220;Undefined&#8221;;<br
/> }<br
/> if(SO = &#8220;Win&#8221;){<br
/> var path = file.split(&#8220;\\&#8221;);<br
/> }else{<br
/> var path = file.split(&#8220;/&#8221;);<br
/> }<br
/> var name_file = (path[path.length-1]);<br
/> var ext_valid = /\.(gif|jpg|png)$/i.test(name_file);<br
/> if (!ext_valid){<br
/> document.getElementById(&#8216;gallery&#8217;).innerHTML = &#8220;&#8221;;<br
/> var empty = document.getElementById(&#8216;gallery&#8217;).value = &#8220;&#8221;;<br
/> alert(&#8220;Your file: &#8221; + name_file + &#8220;, contains a forbidden extension for the gallery. Please make your option again.&#8221;);<br
/> return false;<br
/> }</p><p> else</p><p> {</p><p> var input = document.getElementById(&#8220;gallery&#8221;);<br
/> var ul = document.getElementById(&#8220;list-gallery&#8221;);<br
/> while (ul.hasChildNodes()) {<br
/> ul.removeChild(ul.firstChild);<br
/> }<br
/> for (var i = 0; i &lt; input.files.length; i++) {<br
/> var li = document.createElement(&quot;li&quot;);<br
/> li.innerHTML = input.files[i].name;<br
/> ul.appendChild(li);<br
/> }<br
/> if(!ul.hasChildNodes()) {<br
/> var li = document.createElement(&quot;li&quot;);<br
/> li.innerHTML = &#039;No Files Selected for Gallery&#039;;<br
/> ul.appendChild(li);<br
/> }<br
/> }<br
/> }</p> ]]></content:encoded> </item> <item><title>By: Andrew P.</title><link>http://davidwalsh.name/multiple-file-upload#comment-32158</link> <dc:creator>Andrew P.</dc:creator> <pubDate>Sat, 12 May 2012 12:34:22 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=5010#comment-32158</guid> <description>Hey...Thank you for this useful code... It&#039;s really useful.I&#039;ve a question about an extra functionality... How to validate the extension of files to be uploaded by using the same  function (function makeFileList() )?... Below my first approach but it only catch the first file, not all files, it means if I try to upload a forbidden file within a list of allowed files, it ignore the filter:
&lt;code&gt;function makeFileListImg() {
var file = document.getElementById(&#039;gallery&#039;).value;
if(navigator.userAgent.indexOf(&#039;Linux&#039;) != -1){
var SO = &quot;Linux&quot;; }
else if((navigator.userAgent.indexOf(&#039;Win&#039;) != -1) &amp;&amp;(navigator.userAgent.indexOf(&#039;95&#039;) != -1)){
var SO = &quot;Win&quot;; }
else if((navigator.userAgent.indexOf(&#039;Win&#039;) != -1) &amp;&amp;(navigator.userAgent.indexOf(&#039;NT&#039;) != -1)){
var SO = &quot;Win&quot;; }
else if(navigator.userAgent.indexOf(&#039;Win&#039;) != -1){
var SO = &quot;Win&quot;; }
else if(navigator.userAgent.indexOf(&#039;Mac&#039;) != -1){
var SO = &quot;Mac&quot;; }
else { var SO = &quot;Undefined&quot;;
}
if(SO = &quot;Win&quot;){
var path = file.split(&quot;\\&quot;);
}else{
var path = file.split(&quot;/&quot;);
}
var name_file = (path[path.length-1]);
var ext_valid = /\.(gif&#124;jpg&#124;png)$/i.test(name_file);
if (!ext_valid){
document.getElementById(&#039;gallery&#039;).innerHTML = &quot;&quot;;
var empty = document.getElementById(&#039;gallery&#039;).value = &quot;&quot;;
alert(&quot;Your file: &quot; + name_file + &quot;, contains a forbidden extension for the gallery. Please make your option again.&quot;);
return false;
}else
{
var input = document.getElementById(&quot;gallery&quot;);
var ul = document.getElementById(&quot;list-gallery&quot;);
while (ul.hasChildNodes()) {
ul.removeChild(ul.firstChild);
}
for (var i = 0; i &lt; input.files.length; i++) {
var li = document.createElement(&quot;li&quot;);
li.innerHTML = input.files[i].name;
ul.appendChild(li);
}
if(!ul.hasChildNodes()) {
var li = document.createElement(&quot;li&quot;);
li.innerHTML = &#039;No Files Selected for Gallery&#039;;
ul.appendChild(li);
}
}
}
&lt;/code&gt;Thanbk you for your help!</description> <content:encoded><![CDATA[<p>Hey&#8230;</p><p>Thank you for this useful code&#8230; It&#8217;s really useful.</p><p>I&#8217;ve a question about an extra functionality&#8230; How to validate the extension of files to be uploaded by using the same  function (function makeFileList() )?&#8230; Below my first approach but it only catch the first file, not all files, it means if I try to upload a forbidden file within a list of allowed files, it ignore the filter:<br
/> <code></p><p> function makeFileListImg() {<br
/> var file = document.getElementById('gallery').value;<br
/> if(navigator.userAgent.indexOf('Linux') != -1){<br
/> var SO = "Linux"; }<br
/> else if((navigator.userAgent.indexOf('Win') != -1) &amp;&amp;(navigator.userAgent.indexOf('95') != -1)){<br
/> var SO = "Win"; }<br
/> else if((navigator.userAgent.indexOf('Win') != -1) &amp;&amp;(navigator.userAgent.indexOf('NT') != -1)){<br
/> var SO = "Win"; }<br
/> else if(navigator.userAgent.indexOf('Win') != -1){<br
/> var SO = "Win"; }<br
/> else if(navigator.userAgent.indexOf('Mac') != -1){<br
/> var SO = "Mac"; }<br
/> else { var SO = "Undefined";<br
/> }<br
/> if(SO = "Win"){<br
/> var path = file.split("\\");<br
/> }else{<br
/> var path = file.split("/");<br
/> }<br
/> var name_file = (path[path.length-1]);<br
/> var ext_valid = /\.(gif|jpg|png)$/i.test(name_file);<br
/> if (!ext_valid){<br
/> document.getElementById('gallery').innerHTML = "";<br
/> var empty = document.getElementById('gallery').value = "";<br
/> alert("Your file: " + name_file + ", contains a forbidden extension for the gallery. Please make your option again.");<br
/> return false;<br
/> }</p><p> else</p><p> {</p><p> var input = document.getElementById("gallery");<br
/> var ul = document.getElementById("list-gallery");<br
/> while (ul.hasChildNodes()) {<br
/> ul.removeChild(ul.firstChild);<br
/> }<br
/> for (var i = 0; i &lt; input.files.length; i++) {<br
/> var li = document.createElement(&quot;li&quot;);<br
/> li.innerHTML = input.files[i].name;<br
/> ul.appendChild(li);<br
/> }<br
/> if(!ul.hasChildNodes()) {<br
/> var li = document.createElement(&quot;li&quot;);<br
/> li.innerHTML = &#039;No Files Selected for Gallery&#039;;<br
/> ul.appendChild(li);<br
/> }<br
/> }<br
/> }</p><p></code></p><p>Thanbk you for your help!</p> ]]></content:encoded> </item> <item><title>By: Ben Gilbert</title><link>http://davidwalsh.name/multiple-file-upload#comment-31492</link> <dc:creator>Ben Gilbert</dc:creator> <pubDate>Mon, 09 Apr 2012 21:18:21 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=5010#comment-31492</guid> <description>This is Probably a bit late, but here is the PHP portion for the handling of the files in the array that will work...&lt;code&gt;if(count($_FILES[&#039;filesToUpload&#039;][&#039;name&#039;])) {
$i = 0;
foreach ($_FILES[&#039;filesToUpload&#039;][&#039;name&#039;] as $file) {
$img = &quot;uploads/clients/&quot;.$file;
move_uploaded_file($_FILES[&#039;filesToUpload&#039;][&#039;tmp_name&#039;][$i], $img);
chmod( $img , 0777 );
$company = $_POST[&#039;exsistingcompanies&#039;];$time = strtotime($row[time] . &#039; + 3 hours&#039;);
$time = date(&quot;m/d/y - h:i a&quot;, $time);$query = &quot;INSERT INTO media_files SET client_id=&#039;$company&#039;, name=&#039;$img&#039;, date_uploaded=&#039;$time&#039;&quot;;
queryMysql($query);
$i++;
}
}&lt;/code</description> <content:encoded><![CDATA[<p>This is Probably a bit late, but here is the PHP portion for the handling of the files in the array that will work&#8230;</p><p><code></p><p>if(count($_FILES['filesToUpload']['name'])) {<br
/> $i = 0;<br
/> foreach ($_FILES['filesToUpload']['name'] as $file) {<br
/> $img = "uploads/clients/".$file;<br
/> move_uploaded_file($_FILES['filesToUpload']['tmp_name'][$i], $img);<br
/> chmod( $img , 0777 );</p><p> $company = $_POST['exsistingcompanies'];</p><p> $time = strtotime($row[time] . ' + 3 hours');<br
/> $time = date("m/d/y - h:i a", $time);</p><p> $query = "INSERT INTO media_files SET client_id='$company', name='$img', date_uploaded='$time'";<br
/> queryMysql($query);<br
/> $i++;<br
/> }<br
/> }</p><p>&lt;/code</code></p> ]]></content:encoded> </item> <item><title>By: Andrew</title><link>http://davidwalsh.name/multiple-file-upload#comment-31467</link> <dc:creator>Andrew</dc:creator> <pubDate>Sat, 07 Apr 2012 01:06:42 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=5010#comment-31467</guid> <description>Really an interesting article! I always thought that to upload two or more files, I should call a flash or java code! Do you know if the new version of IE have the same problem and need the flash plug in to upload more than one files?
I think it would fantastic if all browser can use this method and leave flash one time forever for this things :)
Anticipated thank for the answer!! ;)Reguard,
Andrew</description> <content:encoded><![CDATA[<p>Really an interesting article! I always thought that to upload two or more files, I should call a flash or java code! Do you know if the new version of IE have the same problem and need the flash plug in to upload more than one files?<br
/> I think it would fantastic if all browser can use this method and leave flash one time forever for this things :)<br
/> Anticipated thank for the answer!! ;)</p><p>Reguard,<br
/> Andrew</p> ]]></content:encoded> </item> <item><title>By: Waqas Bari</title><link>http://davidwalsh.name/multiple-file-upload#comment-31427</link> <dc:creator>Waqas Bari</dc:creator> <pubDate>Tue, 03 Apr 2012 03:36:35 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=5010#comment-31427</guid> <description>Thanks for sharing, It helped me a lot....</description> <content:encoded><![CDATA[<p>Thanks for sharing, It helped me a lot&#8230;.</p> ]]></content:encoded> </item> <item><title>By: kright</title><link>http://davidwalsh.name/multiple-file-upload#comment-31244</link> <dc:creator>kright</dc:creator> <pubDate>Mon, 26 Mar 2012 10:22:13 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=5010#comment-31244</guid> <description>I achieved some of what I wanted, we had to increase the number of file upload in php.ini, for variable max_file_uploads because the default is 20. For those who do not have this variable in php.ini, you just add it.</description> <content:encoded><![CDATA[<p>I achieved some of what I wanted, we had to increase the number of file upload in php.ini, for variable max_file_uploads because the default is 20. For those who do not have this variable in php.ini, you just add it.</p> ]]></content:encoded> </item> <item><title>By: kright</title><link>http://davidwalsh.name/multiple-file-upload#comment-31207</link> <dc:creator>kright</dc:creator> <pubDate>Fri, 23 Mar 2012 10:03:24 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=5010#comment-31207</guid> <description>Thank you for tutorial, it&#039;s really great, I have a trouble when I try your demo I can upload over 200 files tandsis I try locally by following the tutorial on your explanation, I do that has 19 upload files even if I select the files delas of 19, he has only 19 upload files. I would like to know how to do so I can upload more than 19 files, also it is possible to have the source of your demo.</description> <content:encoded><![CDATA[<p>Thank you for tutorial, it&#8217;s really great, I have a trouble when I try your demo I can upload over 200 files tandsis I try locally by following the tutorial on your explanation, I do that has 19 upload files even if I select the files delas of 19, he has only 19 upload files. I would like to know how to do so I can upload more than 19 files, also it is possible to have the source of your demo.</p> ]]></content:encoded> </item> <item><title>By: Reneesh T K</title><link>http://davidwalsh.name/multiple-file-upload#comment-31004</link> <dc:creator>Reneesh T K</dc:creator> <pubDate>Wed, 14 Mar 2012 10:20:50 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=5010#comment-31004</guid> <description>Hi,After a long search I have also created a multiple file uploader using ajax with a jquery progressbar. It is a combination of two famous packages. May somebody will get help of ithttp://myphplibrary.blogspot.in/2012/03/jquery-file-uploader-with-progress-bar.html</description> <content:encoded><![CDATA[<p>Hi,</p><p>After a long search I have also created a multiple file uploader using ajax with a jquery progressbar. It is a combination of two famous packages. May somebody will get help of it</p><p><a
href="http://myphplibrary.blogspot.in/2012/03/jquery-file-uploader-with-progress-bar.html" rel="nofollow">http://myphplibrary.blogspot.in/2012/03/jquery-file-uploader-with-progress-bar.html</a></p> ]]></content:encoded> </item> <item><title>By: edoardo849</title><link>http://davidwalsh.name/multiple-file-upload#comment-30664</link> <dc:creator>edoardo849</dc:creator> <pubDate>Thu, 01 Mar 2012 17:09:44 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=5010#comment-30664</guid> <description>Dude, 6 hours... I googled 6 hours on this issue until I found out your post. Only one word: thanks!!!</description> <content:encoded><![CDATA[<p>Dude, 6 hours&#8230; I googled 6 hours on this issue until I found out your post. Only one word: thanks!!!</p> ]]></content:encoded> </item> <item><title>By: skor</title><link>http://davidwalsh.name/multiple-file-upload#comment-30299</link> <dc:creator>skor</dc:creator> <pubDate>Sat, 25 Feb 2012 03:38:46 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=5010#comment-30299</guid> <description></description> <content:encoded><![CDATA[]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 3/7 queries in 0.014 seconds using disk: basic
Object Caching 805/805 objects using disk: basic

Served from: davidwalsh.name @ 2012-05-23 11:04:36 -->
