Getting started with Upload

32 posts, 1 answers
  1. Aziz
    Aziz avatar
    32 posts
    Member since:
    Sep 2011

    Posted 28 Sep 2011 Link to this post

    can you perhaps provide the complete origional method for SaveChunkData? the reason for this is that I need to lock the file upon creation untill all chunks are written (file is completely sent)...

    my other option is to upload the file completly to a 'temp' and once uploaded move it to the 'destination'
  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 03 Oct 2011 Link to this post

    Hello Jacob,

    You can implement your scenario by overriding the SaveChinkData method and using the IsNewFileRequest() and IsFinalFileRequest() methods. The first method returns true if the current request contains the first chunk of the uploaded file so if it returns true you can lock the file. And if the IsFinalFileRequest() method returns true, this means that the current request contains the final chunk of the uploaded file so you can unlock the file:
    public override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)
        if (this.IsNewFileRequest())
            //lock the file
        bool result = base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);
        if (this.IsFinalFileRequest())
            //unlock the file
        return result;

    You can find more info about the RadUploadHandler methods and properties here. I hope this info will help you.

    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top