on 12-07-2018 9:44 PM
Hi,
I ask a question about uploadcollection.When ı upload a file,if filename length is greater than maximumFilenameLength,filenameLengthExceed function execute.But ı want to change filename and execute change function,if filename length is greater than maximumFilenameLength.How can ı do this function.
Thanks in advance
I am doing the same thing.
fileExt = oFile.name.split(".");
if (fileExt[0].length > 45) {
fileName = fileExt[0].slice(0, -(fileExt[0].length - 45)) + "." + fileExt[1];
}
The oFile is read only, so you need to create a new json with the data. You cant change the name on the file.
contentType = oFile.type;
fileBlob = new Blob([oFile], {
type: "application/octet-stream"
});
reader.readAsDataURL(fileBlob);
reader.onloadend = function() {
fileBlobB64 = reader.result;
b64file = fileBlobB64.split(",")[1];
}
file = {
"docData": b64file,
"extension": fileExt[1],
"documentMimeType": contentType,
"documentName": fileName,
"size": oFile.size,
"url": URL.createObjectURL(oFile)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hazal Oguce
I dont think uploadcollection has some functionality like that, but what you can do is, when you add the "slug"(filename) to the file that you are attaching in the change event, check if the file length exceeds, then you can change the file name and pass it to the "slug" parameter.
So you can turn off the file limit and handle it manually in the change event.
BR,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.