javascript - How do I make the thumbnails appear below the "Add File" button? -


i have code show thumbnail preview of file user chooses upload. however, want more this:

i trying accomplish few things thumbnail part:

  1. to show thumbnail previews below "add file" button
  2. to show image smaller image image, file preset image of file, , video thumbnail video play symbol on (see link above examples)
  3. to set maximum of 5 possible files uploaded.

    <script type="text/javascript">     $(function() {     $("#uploadfile").on("change", function()     {         var files = !!this.files ? this.files : [];         if (!files.length || !window.filereader) return; // no file selected, or no filereader support          if (/^image/.test( files[0].type)){ // image file             var reader = new filereader(); // instance of filereader             reader.readasdataurl(files[0]); // read local file              reader.onloadend = function(){ // set image data background of div                 $("#imagepreview").css("background-image", "url("+this.result+")");             }         }     }); }); 

1) show thumbnail previews below "add file" button

move tag id="imagepreview" bellow file input

2) show image smaller image image, file preset image of file, , video thumbnail video play symbol on (see link above examples)

set css #imagepreview ex: #imagepreview { width: 100px; height: 100px; }

3) have no upload functionality provided, ... no more 1 field , preview in code ... how can you? - add counter global var , check ... when reaches 5 ... hide file input


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -