Closed stefanKBL closed 8 years ago
ok, response to myself, seems to be ok with get the image id before javascript append.
var imgid = uploader._queue[uploader._queue.length-1].id;
And then replace filename by imgid in the append. Then, in the remPreviewImg, just call the uploader function with imgid in parameter.
uploader.removeCurrent(imgid);
Is it correct ? It works ! Thanks
Hi, i have config for preview thumbs before submit. That's ok. But i need to remove the image from the queue when user click on Remove Link, which is available for each thumb. It's ok to remove from the DOM, but when i submit the form, image is still available in the queue. Which is logic, but i can't find how to remove individually. thanks
var uploader = new ss.SimpleUpload({ method: "POST", button: btn, url:base_url+'upload/image', name: 'imgfile', multiple: true, multipart: true, maxUploads:3, maxSize: 2000, queue: false, allowedExtensions: ['jpg', 'jpeg', 'png'], accept: 'image/*', debug: false, hoverClass: 'btn-hover', focusClass: 'active', disabledClass: 'disabled', responseType: 'json', autoSubmit:false, onChange: function(filename, extension, uploadBtn,filesize,file) { var oFReader = new FileReader(); oFReader.readAsDataURL(file); oFReader.onload = function (oFREvent) { var t=Math.floor(Math.random() * (10000000 - 1000 +1)) + 1000; $('#wrapper_upload_thumb').append('<div id="'+filename+'_'+t+'" style="float:left;width:90px;height:90px"><img style="height:75px;width:75px;padding:5px" src="'+oFREvent.target.result+'" /><br /><a class="remPreviewImg" onclick="javascript:remPreviewImg(\''+filename+'_'+t+'\');">REMOVE IMAGE</a></div>'); };