Skip to content Skip to sidebar Skip to footer

Set Input Value In Form From Another Input , Dynamically

I trying to upload image to website with its title . I want user to see image before uploading . HTML

Image Uploader

Solution 1:

maybe this can help you.

<divclass="container"><h1>Image Uploader</h1><inputid="fileItem"type="file"name="images[]"id="images"multiple><br><divid="images-to-upload"class="row"></div><br><divclass="col-md-12"><buttonid="upload_button"class="btn btn-sm btn-success col-md-4 col-xs-12">Upload all images</button></div></div>

Javascript

$('#upload_button').click(function(){
    var files = document.getElementById('fileItem').files;
    console.log(files)
    $.each(files, function(index, item) {
       //console.log(index, item);console.log(item.name);
       // here you can do anything with name of file.// maybe here you can create your form
    });

  });

test it jsfiddle

Post a Comment for "Set Input Value In Form From Another Input , Dynamically"