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

Get the full file name on client side

5 Answers 264 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Chandra
Top achievements
Rank 1
Chandra asked on 29 Mar 2013, 02:59 PM
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

5 Answers, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 01 Apr 2013, 04:11 PM
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.
0
Chandra
Top achievements
Rank 1
answered on 02 Apr 2013, 09:02 AM
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
0
Hristo Valyavicharski
Telerik team
answered on 05 Apr 2013, 10:11 AM
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.
0
Richard Irwin
Top achievements
Rank 1
answered on 23 Jun 2016, 08:16 PM

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

 

0
Veselin Tsvetanov
Telerik team
answered on 27 Jun 2016, 02:01 PM
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.
Tags
AsyncUpload
Asked by
Chandra
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Chandra
Top achievements
Rank 1
Richard Irwin
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or