Renamed files on the server

5 posts, 0 answers
  1. Peter Terkildsen
    Peter Terkildsen avatar
    16 posts
    Member since:
    Mar 2010

    Posted 18 Mar 2015 Link to this post

    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
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 18 Mar 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Peter Terkildsen
    Peter Terkildsen avatar
    16 posts
    Member since:
    Mar 2010

    Posted 18 Mar 2015 in reply to Dimiter Madjarov Link to this post

    Hi Dimiter,

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

    Regards,

    Peter
  5. Adam
    Adam avatar
    5 posts
    Member since:
    Mar 2015

    Posted 22 Jul Link to this post

    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! 

  6. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 25 Jul Link to this post

    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.
     
Back to Top
Kendo UI is VS 2017 Ready