rhughes rhughes - 4 years ago 197
Javascript Question

FineUploader button text

I have scoured the FineUploader documentation, but when I set my upload button text like below, the change does not seem to propagate. The upload button still displays the default text. What am I missing?

var manualuploader = new qq.FileUploader({
element: document.getElementById('manual-fine-uploader'),
text: {
uploadButton: "Select a File" // <========== Setting text here
},
action: "/file/upload",
autoUpload: false,
multiple: false,
forceMultipart: true,
onComplete: function (id, fileName, json) {

$("#divFileUploadLoading").hide();
$("#buttonUploadFile").show();

if (json.success) {

displaySuccessMessage("Successfully uploaded: " + fileName);

$("#textFileTitle").val("");
$("#textFileDescription").val("");
$("#checkIsDownloadable").prop("checked", true);
$("#checkDisplayDetails").prop("checked", true);
}
else {

displayErrorMessage("Failed to upload: " + fileName + " because '" + json.errorMessage + "'");
}

g_FileCount = 0;

manualuploader.clearStoredFiles();
manualuploader.reset();
},
onSubmit: function (id, fileName) {

g_FileCount++;
},
onCancel: function (id, fileName) {

$("#divFileUploadLoading").hide();
$("#buttonUploadFile").show();

displaySuccessMessage("Canceled upload for: " + fileName);

g_FileCount--;
}
});

Answer Source

Tested and verified. You still need to use the "text" option.

text: {
  uploadButton:'<div>Select a file</div>'
}

Another way to do it is to create your own button with the button: option.

JS:

button: document.getElementById('my-button')

HTML:

<div id="my-button" class="qq-upload-button">Select a file</div>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download