Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Commit

Permalink
edited
Browse files Browse the repository at this point in the history
  • Loading branch information
maggiewachs committed Jan 17, 2012
1 parent 8beafc8 commit 87dfca9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Code Examples from the book [Designing with Progressive Enhancement](http://fila

This repository includes open-sourced code developed and maintained by Filament Group, Inc. as part of the book "Designing With Progressive Enhancement" (Peachpit).

Those who purchase the book can access to all of the examples from the book at the following URL: http://filamentgroup.com/dwpe#codeexamples
Those who purchase the book can access all of the examples from the book at the following URL: http://filamentgroup.com/dwpe#codeexamples.

All examples use the [jQuery JavaScript library](http://jquery.com)
All examples use the [jQuery JavaScript library](http://jquery.com).

These code examples use the [EnhanceJS framework](https://github.com/filamentgroup/EnhanceJS) for applying progressive enhancement based on browser capabilities testing.

1 comment on commit 87dfca9

@sptutusukanta
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To implement multiple file input strategy, I have modified the code for myself. The JS code will have no problem if input type is multiple or not. It will work seamlessly. I Request you to test and change the original accordingly.
Hereby, I'm giving the code-sections that I have modified.


file: jQuery.fileinput.js

....
....
    .bind('change',function(){
            var count = this.files.length; // get number of files selected
            // if more than 1 file are selected show text like "5 files selected"
            if(count>1){  
                uploadFeedback
                .text(count+" files selected")
                .removeClass(uploadFeedback.data('fileExt') || '');
            }else{
                //get file name
                var fileName = $(this).val().split(/\\/).pop();
                //get file extension
                var fileExt = 'customfile-ext-' + fileName.split('.').pop().toLowerCase();
                //update the feedback
                uploadFeedback
                    .text(fileName) //set feedback text to filename
                    .removeClass(uploadFeedback.data('fileExt') || '') //remove any existing file extension class
                    .addClass(fileExt) //add file extension class
                    .data('fileExt', fileExt) //store file extension for class removal on next change
                    .addClass('customfile-feedback-populated'); //add class to show populated state

            }
            //change text of button 
            uploadButton.text('Change');
        })
....
....

file: index.html

....
....
<input type="file" name="file" id="file" multiple="multiple"/>
....
....

Please sign in to comment.