Accessing the original file name with a jQuery direct upload
I'm uploading the images directly with jQuery, generating an input field with the signature with a Java Spring controller. I would like to show the original file name of the selected images, at the beginning of the uploading process, and in case some fails, I would like to show its name. This is an extract of my jQuery code, where I guess I should be able to reach them:
$(".cloudinary-fileupload").cloudinary_fileupload({
start: function(e, data){
SOME CODE TO GET THE ORIGINAL FILE NAME...
}
fail: function(e, data){
SOME CODE TO GET THE ORIGINAL FILE NAME...
}
As a different approach, I've tried to get the input field values with Javascript, but I haven't been able to set a change listener, to the input field generated by the Cloudinary code.
Thanks in advance for your help.
Aleix Alcover
-
Hello Aleix,
I would like to apologize for the late reply. We do have a way to retrieve the original file name at the beginning of the upload process. I have added the code snippet below. Please let me know if this works for you.
$(".cloudinary-fileupload").cloudinary_fileupload({
add: function(e, data){
console.log(data.files[0].name);data.submit(); // Needed to continue executing the remainder of the code below
}start: function(e, data){
SOME CODE TO GET THE ORIGINAL FILE NAME...
}
fail: function(e, data){
SOME CODE TO GET THE ORIGINAL FILE NAME...
}0
Post is closed for comments.
Comments
1 comment