Thank you for the clarification.
Actually there are two main approaches to rename uploaded files
- Client side.
This is the easiest way and it was already described in the How to upload a file with a different name article.
Pros: The upload handler was not modified - actually you can use any existent handler to receive the uploaded file.
Cons: This not an appropriate technique for realizing an unique file name.
- Server side.
File rename process is implemented in the upload handler and the client code my not participate.
Pros: This is the better way to get an unique file name. Actually you can try as many different names as you want.
Cons: The upload handler is a specialized one.
Here you have two different ways:
- Rename at the and of the upload process.
Not so sophisticated approach. Even more you can override an existing file or another uploader can override your file. Here you should override the ProcessStream method and inside it you should wait for the final upload chunk like in the code below:
The good example is the Process files on the server after upload article. Here names of all successfully uploaded files are collected by the client code and resend to the upload handler. Note, the custom process (rename process) starts after all files are uploaded.
|public override void ProcessStream()
| // Check if this is the last chunk
| if (this.IsFinalFileRequest())
| // here you can do your Custom Action
- Rename at beginning of the upload process.
This is the best approach and it is described in the Saving files with unique name on the server using RadUploadHandler article. Actually you can use this technique to upload files in a temp folder and only after successful upload to publish them in the official folder.
Please note the RadUpload can not re-upload files neither after successful upload nor after failed one. This is the reason we have advised you already to use the Saving files with unique name on the server using RadUploadHandler
Let us know if we can assist you further.
the Telerik team