Renaming file before async post

2 posts, 0 answers
  1. Christina
    Christina avatar
    4 posts
    Member since:
    Nov 2012

    Posted 26 Apr 2013 Link to this post

    Hi,

    Is there a way of changing the filename of a file (within the Javascript)  that is about to be posted asynchronously? For example I have tried in the select method of the upload tool, the following:

    "select": function (e) {
              e.files[0].name = "changed_named.jpg";
    }

    However, when the file reaches my MVC controller action, the HttpPostedFileBase object has the original filename. I've also tried doing this in the 'upload' event with no luck.

    Thanks,
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 29 Apr 2013 Link to this post

    Hello,

    The name field is listed as read-only in the specification. My suggestion is to send the desired name as metadata and use it in the controller.

    I hope this helps.

    Regards,
    Tsvetomir Tsonev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top