I'm using the upload-control. It's working very fine.
However, I have implemented code server-side that checks for whether a file already exists at the server. If it does, the file is renamed to something like 'file(1).jpg' in order not overwrite the existing file.
I'm trying to figure out how to send the information about the renamed file back to the Upload-control. Is this possible?
I'm using AngularJS, btw.
Regards,
Peter
4 Answers, 1 is accepted
Hello Peter,
You could send metadata from the save handler back to the upload widget as a json string with content type "text/plain". On the client side it could be accessed in the success handler through the e.response parameter. Examples could be found in the documentation here and here.
Regards,Dimiter Madjarov
Telerik
Thank you very much! This pointed me in the right direction. :-)
Regards,
Peter
Hi,
I would like to follow-up on this with another question. I have the exact same scenario, where the file is being renamed on the server-side. I understand how to get the meta data from the response in the success handler, but is there a way to take the name that the server gives me and have the kendo upload widget reflect this new name in the list of files displayed.
By the time the success handler is called, the newly upload file has been painted on the screen and I'm not sure how to update the name of the file displayed.
Thanks!
Hello Adam,
You could use the uid property of the uploaded file to find it in the list of files in the widget. It is set as data-uid attribute to the list item. Here is an example of this scenario.
Dimiter Madjarov
Telerik by Progress