This jQuery Multiple File Upload Plugin ($.MultiFile
)
is a non-obstrusive plugin for jQuery
that helps users easily select multiple files for upload quickly and easily
on your hosting server
whilst also providing some basic validation functionality to help developers
idenfity simple errors, without having to submit the form (ie.: upload files).
This plugin will not create a dialog that allows the user to select multiple files at once.
That simply cannot be done via javascript. If that's what you need, you should consider using
HTML5's multiple="multiple"
attribute
or one of the many other
flash based file upload solutions
(eg.: SWFupload, uploadify and others)
The plugin creates a new file input element every time the user select a file, which allows the user to select a file, then another, then another, then another and so on... selecting as many files is required, one at a time.
Just add the
|
Use the
|
Use the
|
This is div#T7-list - selected files will be populated here...
|
This is div#F9-Log - selected files will be populated here...
|
$(function(){ // wait for document to load
$('#MyFileUpload').MultiFile();
});
$(function(){ // wait for document to load
$('#MyFileUpload').MultiFile(5 /*limit will be set to 5*/);
});
$(function(){ // wait for document to load
$('#MyCoolFileUpload').MultiFile({
max: 5,
accept: 'gif|jpg|png|bmp|swf'
});
});
$(function(){ // wait for document to load
$('#PortugueseFileUpload').MultiFile({
STRING: {
remove:'Remover',
selected:'Selecionado: $file',
denied:'Invalido arquivo de tipo $ext!'
}
});
});
The plugin doesn't have any additional languages built-in, but it's very easy to customise the messages to any language of your choosing. See the examples below...
NB.: This example has been configured to accept gif/pg files only in order to demonstrate the error messages.
<input type="file" class="multi
{accept:'gif|jpg', max:3, STRING:{
remove:'Remover',
selected:'Selecionado: $file',
denied:'Invalido arquivo de tipo $ext!',
duplicate:'Arquivo ja selecionado:\n$file!'
}}" />
<input type="file" id="PortugueseFileUpload" />
$(function(){
$('#PortugueseFileUpload').MultiFile({
accept:'gif|jpg', max:3, STRING: {
remove:'Remover',
selected:'Selecionado: $file',
denied:'Invalido arquivo de tipo $ext!',
duplicate:'Arquivo ja selecionado:\n$file!'
}
});
});
<input type="file" class="multi-pt" />
<input type="file" class="multi-pt" />
<input type="file" class="multi-pt" />
$(function(){
$('.multi-pt').MultiFile({
accept:'gif|jpg', max:3, STRING: {
remove:'Remover',
selected:'Selecionado: $file',
denied:'Invalido arquivo de tipo $ext!',
duplicate:'Arquivo ja selecionado:\n$file!'
}
});
});
No, this jQuery plugin does not upload files
Javascript is a client side language and cannot upload files - this plugin will only go as far as helping the user select the files to upload and assisting in the validation process by warning the user of common mistakes before server-side validation takes place. When the form is submitted, it's up to you to have a server-side script that will actually upload the files.
Please do not email me asking how to do this!!! There is plenty of information out there and you can easily find it on Google. But because I'm such a nice guy, I've put a quick list of the best links here:
FreeASPUpload - Free, easy to use and no component required. This is my favourite.
Pure ASP File Upload by Jacob Gilley
File Upload via ASP (Pure ASP Solution, no .DLL)
See File Upload Tutorials from W3CSchools, About.com, Tizag
NOTICE TO PHP USERS:
The plugin's default behaviour generates an array of elements (sharing the same name).
In order for this array to be properly identified and handled in PHP, you have to add "[]" to name of your element.
eg.:
<input type="file" name="MyStuff[]"...
1. Make sure your form has method=POST and enctype=multipart/form-data
2. Are you using valid (x)HTML? Invalid markup can stop the form from being submitted altogether
3. Are you using the correct element names as required/expected by your server-side script?
4. Have you tried uploading a single file without using the plugin? Makes sure this works before submitting a bug report
You should know that the plugin works by hiding elements with a selected file and creating new empty elements. This means when submitting the form, there will always be an empty item at the end of the list of files. Actually, that would have been a problem but this plugin takes care of disabling all dummy empty file inputs for you before the form gets submitted - be it via ajax or natively. So this is good to know, but it's not something you need to worry about.
However, if you are submitting the form programmatically via javascript, you must call this before submitting the form....
$.fn.MultiFile.disableEmpty(); // before submiting the form
And if you're doing things the ajax way, you should call this when you're done to re-enable the dummy element:
$.fn.MultiFile.reEnableEmpty(); // after submiting the form
You may use the jQuery Form Plugin to submit the form via ajax.
To reset the file selections, just make the following call:
$('input:file').MultiFile('reset')
This project (and all related files) can also be accessed via its Google Code Project Page.
Full Package: | v1.48 multiple-file-upload.zip |
Stay up-to-date!
Major updates will be announced on
Twitter:
@fyneworks
|
|
Core Files: |
These are the individual required files (already included in the zip package above)
|
jQuery: | jquery-latest.js (see jQuery.com) |
Download www.activextest.com program for free and keep your computer protected for improved speed, performance and operation!
Related: |
Metadata plugin - Used to retrieve inline configuration from class variable
blockUI plugin - Used to show pretty error messages Form plugin - Used to submit forms via ajax |
<script src="jquery-latest.js" type="text/javascript" language="javascript"></script>
<script src="jquery.MultiFile.js" type="text/javascript" language="javascript"></script>
Metadata Plugin
This great plugin can be used to configure the plugin via the class parameter.
You can also download the version being used on this page
BlockUI Plugin
Used to show 'pretty' error messages, instead of the browser's alert() function.
You can also download the version being used on this page
Form Plugin
Used to submit forms via Ajax.
If you're a major geek or if you really really want to stay up-to-date with with future updates of this plugin, go ahead and plug yourself to the SVN Repository on the official Google Code Project Page.
SVN Checkout: | SVN Checkout Instructions |
Browse Online: | Browse Source |
Just in case it's the end of the world and the Google Code site becomes unavailable,
the project files can also be downloaded from this site.
However, please note that this site is updated periodically whereas the Google Code
project is kept up-to-date almost instantaneously. If you'd like the very latest
version of this plugin
you are advised to use the links above and download the files from Google Code
- this will ensure the files you download have the very latest features and bug fixes.
Full Package: | v1.48 multiple-file-upload.zip |
Stay up-to-date!
Major updates will be announced on
Twitter:
@fyneworks
|
|
Core Files: |
These are the individual required files (already included in the zip package above)
|
jQuery: | jquery-latest.js (see jQuery.com) |
Quick Support Links: Help me! | Report a bug | Suggest new feature
Support for this plugin is available through the jQuery Mailing List.
This is a very active list to which many jQuery developers and users subscribe.
Access to the jQuery Mailing List is also available through
Nabble Forums
and the
jQuery Google Group.
WARNING: Support will not be provided via the jQuery Plugins website. If you need help, please direct your questions to the jQuery Mailing List or report an issue on the official Google Code Project Page.
There's no catch. Use it, abuse it - even take it apart and modify it if you know what you're doing. You don't have to, but if you're feeling generous you can link back to this website (instructions below).
Attribution link: | © Fyneworks.com |
HTML Code: |
Multiple File Upload Plugin by Fyneworks.com is licensed under the MIT License and the GPL License. | |
Copyright © 2008 Fyneworks.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Multiple File Upload PluginProvides a non-obstrusive way of selecting multiple files for upload. Supports validation and form plugins. Star-Rating PluginCreates a non-obstrusive star-rating control from any set of radio boxes. Features include half/partial stars and an API for programmatic control. Supports the validation plugin. XML to JSONConvert XML to JSON and read data from XML files/RSS feeds with ease. |
CKEditor PluginjQuery plugin for non-obstrusive integration of textareas with CKEditor. FCKEditor Plugin
jQuery plugin for non-obstrusive integration of textareas with FCKEditor.
Codepress PluginjQuery plugin for non-obstrusive integration of textareas with Codepress. |
Multiple File Upload, Star Rating, CKEditor XML to JSON | [back to top] | ||
jQuery Plugins
by Fyneworks.com
Licensed under the MIT License and the GPL License. |
Tested with jQuery 1.7 on: IE6, IE7, IE8, FF, Chrome, Opera and Safari |