1. Show image when select using Image Loader

function showimagepreview(input)

{

if (input.files && input.files[0])

{

var filerdr = new FileReader();

filerdr.onload = function(e) {

jQuery(‘#imgprvw’).attr(‘src’, e.target.result);

//jQuery(‘#imgprvw’).attr(‘src’, e.target.result);

}

var extension = input.files[0].name.split(‘.’).pop().toLowerCase(); //file extension from input file

var fileExtension = [‘jpeg’,’jpg’,’png’,’gif’,’bmp’,’JPEG’,’JPG’,’PNG’,’GIF’,’BMP’];

if (jQuery.inArray(extension, fileExtension) == -1)

{

alert(“Only .jpeg .jpg .png .gif .bmp formats are allowed.”);

return false;

}

else

{

filerdr.readAsDataURL(input.files[0]);

}

}

}

 

  1. Send Array of Images :-
take array in name of file to upload multiple file in php
like take ‘file[]’ instead ‘file’

Leave a Reply