Home / Community & Support / Knowledge Base / RadControls for Silverlight / Upload / RadUpload ChunkTag or how to deal with uploaded files by chunk.

RadUpload ChunkTag or how to deal with uploaded files by chunk.

Article Info

Rating: 4

Article information

Article relates to

 RadUpload for Silverlight

Created by

 Ivan Efimov

Last modified

 28-09-2010

Last modified by

Tina Stancheva

 

Telerik RadUpload for Silverlight supports Chunk tagging. Thus, the UploadHandler has the ability to tag the uploaded chain of chunks. For example, you can use the ChunkTag to save the uploaded files in a database by chunk and not to wait for the whole file to be uploaded (and saved to disk by default). Below are two main points you should be aware of when you customize your upload-handler.

  1. Chunk-Tag rely on two properties in the RadUploadHandler class:
    • FormChunkTag - the ChunkTag value supplied by the upload-client for the current chunk;
    • ResultChunkTag - gets or sets the ChunkTag value returned from the upload-handler to the upload-client.
    You can embed the initialization code in the InitializeChunkStorage method like so: 
     
    public override bool InitializeChunkStorage(string filePath)
    {
        if (this.IsNewFileRequest())
        {
            this.ResultChunkTag = MyUniqueKeyGenerator.GetKey();
        }
        else if (this.FormChunkTag != null)
        {
            this.ResultChunkTag = this.FormChunkTag;
        }
        ...
     
     
  2. Save the uploaded data. Here you have two options:
    • Override the SaveChunkData method.
 
In the attached archive you can find a project-skeleton that overrides the InitializeChunkStorage and the SaveChunkData methods.

Comments

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.