Get the full file name on client side

6 posts, 0 answers
  1. Chandra
    Chandra avatar
    2 posts
    Member since:
    Mar 2013

    Posted 29 Mar 2013 Link to this post

    Hi,

    Is there any way to get the full file name uploaded on the server on client side i.e., if I am uploading a file with the name 'abc.jpg' its been stored on the server as '838238909abc,jpg'. On the client side i need this new name of the file.

    Thanks
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 01 Apr 2013 Link to this post

    Hi Chandra,

    The new name actually is temporary name. It is used internally by RadAsyncUpload. It first uploads files in Temporary folder. After that files are automatically moved into the Target folder. To get better understanding what's happen please read this article.

    On the client the the real file name you can get immediately after the file is uploaded in OnClientFileUploaded:
    function OnClientFileUploaded(sender, args) {
        var fileName = args.get_fileName();
    }

    Regards,
    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chandra
    Chandra avatar
    2 posts
    Member since:
    Mar 2013

    Posted 02 Apr 2013 Link to this post

    Thanks Hristo.

    Actually the way I am handling things are different. On my page I wont be posting the data back to server, instead want to hand the data insertion using the JavaScript/AJAX. So, a user uploads the file using AsyncUpload and clicks on a button, this button will send the data to server to a webservice and this webservice will insert the data to database. In case of files, if i can send the file name then i can get it from the temp folder and save it in the path that i need it to be saved. Hence I need to know the complete file names of the files saved in temp folder.

    Thanks
  5. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 05 Apr 2013 Link to this post

    Hi Chandra,

    It is not possible to get the Temporary file name on the client. I suggest you to use Custom Handler instead of WebService. It allow you to get and modify the file name. This online demo shows how to modify and save uploaded file into the database.

    Regards,
    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Richard Irwin
    Richard Irwin avatar
    3 posts
    Member since:
    Mar 2009

    Posted 23 Jun in reply to Hristo Valyavicharski Link to this post

    so when I use the client side handling I get the file name not the temporary file name

     

    var fileName = args.get_fileName();

     

    The file I uploaded is fff.cvs and if I try to open the file it cannot be found

     

  7. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    286 posts

    Posted 27 Jun Link to this post

    Hello Richard,

    As Hristo already stated, there is no way to get the name of the temporary file saved on the server from a client side call. In the OnClientFileUploaded event handler you can get only the initial file name (args.get_fileName()). If you need to open / load the uploaded file in the browser, I would recommend you to use server side handling, as it is shown in the following RadAsyncUpload demo.

    Regards,
    Veselin Tsvetanov
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017