I am using showFileDetails: false.
I don't want to use standard Cancel button. I have another logic.
I need method or something which I can reset UploadBox with JS.
These are settings for creating UploadBox:
$(element).ejUploadbox({
saveUrl: "some url",
showFileDetails: false,
extensionsAllow: ".png, .jpg",
$("#UploadDefault").ejUploadbox({
showFileDetails: false,
extensionsAllow: ".png,.jpg",
autoUpload: true,
fileSelect: function (args) {
for (i = 0; i < args.files.length; i++) {
if (args.files[i].name == "Drag-and-Drop-img1.png") // set the file name or extension based on your requirement
{
this._removeFile(args.files[i]); // remove the file
this._currentElement.find(".e-uploadinput").val("");
this._resetFileInput(this._currentElement.find(".e-uploadinput")); //reset the upload box input
}
}
},
success:function(args)
{
$("#ListFiles").append('<tr><td>' +args.files.name +" has been uploaded successfully"+ '</td></tr>');
}
}); |
Ok, but I need this not appended in the select event of the control, but I need it when is clicked custom button. How to access these methods in no UploadBox events, but events for custom html tags ?
Hi, I don't use auto upload. I am using click button event for that.
When file is selected JS creates the preview - selected image with cancel button (X), but not auto uploading . I am using select UploadBox event to create this preview.
When cancel button is clicked, it deletes only the image from HTML (the preview). The image is not uploaded before clicking save button.
I don't use file details, because I have another design without this popup and only image with X button in specific container.
There is no multiple files upload. It is only 1 file and X button on it.
function reset()
{
var uploadobj = $("#UploadDefault").data("ejUploadbox");
uploadobj._removeFile(uploadobj.inputupload[0].files[0]);
uploadobj._currentElement.find(".e-uploadinput").val("");
uploadobj._resetFileInput(uploadobj._currentElement.find(".e-uploadinput"));
$("#file")[0].remove();
$("#cancel").css("display", "none");
}
function OnUpload() {
var uploadobj = $("#UploadDefault").data("ejUploadbox");
uploadobj.upload();
} |
Thanks, it works.