My English is not the best, so apologies in advance. I'm struggling to customize the FineUploader FileTemplate option. I don't want to use fineUploaderBasic; I want total customization. Initially, I managed to hide the file name and size after a successful upload. However, customizing the delete button has proven to be an issue. After the upload, the delete button appears but remains disabled, making it impossible to click. Below is my code:
var restricteduploader = new qq.FineUploader({
element: $('#restricted-fine-uploader')[0],
text: {
uploadButton: '<div><i class="icon-upload icon-white"></i>Subir Imagen</div>',
deleteButton: '<input type="button" id="btnDelete" value="Eliminar imagen" />'
},
template:
'<div class="qq-uploader">' +
'<div class="qq-upload-drop-area"><span>{dragZoneText}</span></div>' +
'<div class="qq-upload-button">{uploadButtonText}</div>' +
'<span class="qq-drop-processing"><span>{dropProcessingText}</span><span class="qq-drop-processing-spinner"></span></span>' +
'<ul class="qq-upload-list"></ul>' +
'</div>',
fileTemplate:
'<li>' +
'<div class="qq-progress-bar"></div>' +
'<span class="qq-upload-spinner"></span>' +
'<span class="qq-upload-finished"></span>' +
'<span class="qq-edit-filename-icon"></span>' +
'<span class="hide-file"></span>' +
'<div>IMAGEN SUBIDA CON EXITO!!</div>' +
'<input class="qq-edit-filename" tabindex="0" type="text">' +
'<span class="hide-size"></span>' +
'<a class="qq-upload-cancel" href="#">{cancelButtonText}</a>' +
'<a class="qq-upload-retry" href="#">{retryButtonText}</a>' +
'<div class="qq-upload-delete">{deleteButtonText}</div>' +
'<span class="qq-upload-status-text">{statusText}</span>' +
'</li>',
classes: {
file: 'hide-file',
size: 'hide-size'
},
request: {
endpoint: '<%= Url.Action("UploadBatchDataFile", "Account") %>'
},
deleteFile: {
enabled: true,
endpoint: '<%= Url.Action("DeleteFile", "Account") %>',
method: 'POST'
},
multiple: false,
validation: {
allowedExtensions: ['jpeg', 'jpg', 'png'],
sizeLimit: 411062 // 50 kB = 50 * 1024 bytes
},
showMessage: function (message) {
$('#restricted-fine-uploader').append('<div class="alert-error">' + message + '</div>');
},
messages: { typeError : "{file} no es un tipo de imagen valido. Imagenes valida(s): {extensions}." },
callbacks: {
onSubmitDelete: function(event, id) {
var filename = $(this).fineUploader('getName', id);
$(this).fineUploader('setDeleteFileParams', {filename: filename}, id);
},
onComplete: function (id, filename, responseJSON) {
if (responseJSON.success) {
$('div div.alert-error').remove();
$('#imgUploaded').attr("src", "<%: Url.Content("~/Images/") %>" + responseJSON.filename);
$('#hidImage').attr("value", "<%: Url.Content("~/Images/") %>" + responseJSON.filename);
}
}
}
});
I find customizing the fileTemplate challenging. Previously, I attempted to integrate the FileTemplate into a table by modifying the template as follows:
'<ul class="qq-upload-list"></ul>' to '<table class="qq-upload-list"></table>'
and adjusting the fileTemplate like this:
'<li>' to '<tr><td>' and '</li>' to </td></tr>
Unfortunately, these changes didn't result in the desired outcome. Following a successful upload, FineUploader failed to display the FileTemplate.