This is a migrated thread and some comments may be shown as answers.

Renamed files on the server

4 Answers 155 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Peter Terkildsen
Top achievements
Rank 1
Peter Terkildsen asked on 18 Mar 2015, 11:58 AM
Hi,

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

Sort by
0
Dimiter Madjarov
Telerik team
answered on 18 Mar 2015, 03:47 PM

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Peter Terkildsen
Top achievements
Rank 1
answered on 18 Mar 2015, 07:31 PM
Hi Dimiter,

Thank you very much! This pointed me in the right direction. :-)

Regards,

Peter
0
Adam
Top achievements
Rank 1
answered on 22 Jul 2016, 06:44 PM

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! 

0
Dimiter Madjarov
Telerik team
answered on 25 Jul 2016, 08:53 AM

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.

Regards,
Dimiter Madjarov
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Upload
Asked by
Peter Terkildsen
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Peter Terkildsen
Top achievements
Rank 1
Adam
Top achievements
Rank 1
Share this question
or