This is my code:
$(function(){ var btnUpload=$('#browse'); var adinfoid=$('#adinfoid').val(); new AjaxUpload(btnUpload, { action: '<?php echo base_url()?>index.php/post/upload_editmainimage/'+adinfoid, name: 'uploadfile', onSubmit: function(file, ext){ $("#progressid").css("display","block"); if (! (ext && /^(jpg|png|jpeg|gif|JPG|PNG|JPEG|GIF)$/.test(ext))){ $("#mainphotoerror").html('Only JPG, PNG, GIF, files are allowed'); $("#mainphotoerror").css('display','block'); return false; } }, onComplete: function(file, response){ //alert(response); if(response){ /*$(".main_image").html(''); $(".main_image").html(response);*/ $("#progressid").css("display","none"); $("#image"+<?php echo $mainimage->intphotoid; ?>).css('display','block'); $("#imagemainicon"+<?php echo $mainimage->intphotoid; ?>).css('display','block'); $("#mainimageicon").attr("src",response); $("#mainimageicon").attr("width",55); $("#mainimageicon").attr("height",55); $("#mainimageicon1").attr("src",response); }else{ alert("error"); } } }); });
<input type="button" id="browse" class="browse_media" value="Browse"> <div id="progressid" class="displayNone"> <img src="//s3.amazonaws.com/s3.racingjunk.com/102/images/procesing.gif" width="117" height="20" /> Uploading..... </div> When I click on the browse button I need to show a progress bar for 5 minutes. After 5 minutes the progress bar will hide or not be shown. After the progress bar hides the image will then display.
How can I do this? Is this possible?