Process the file once it's uploaded

8 posts, 0 answers
  1. Wayne Bradney
    Wayne Bradney avatar
    12 posts
    Member since:
    Apr 2010

    Posted 08 May 2010 Link to this post

    How would I process the file inside the handler once it's uploaded?

    I can override the ProcessRequest method inside the handler, call the base version, and then open the file, but how would I figure out the file's location in order to do that?

    I have the TargetFolder and the FileName available to me, but not the physical path to that target folder on the file system.
  2. Ivan
    Admin
    Ivan avatar
    519 posts

    Posted 09 May 2010 Link to this post

    Hi Wayne Bradney,

    Thank you for contacting us.

    You can try the GetFilePath method. Other methods you should engage in your code are: IsNewFileRequest, IsFinalFileRequest, IsFinalUploadRequest.

    Please be aware we updated the upload control a bit and you may experience troubles with some of our old articles and examples. If so please drop us a line and we will help you.


    Greetings,
    Ivan
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Fred
    Fred avatar
    45 posts
    Member since:
    Apr 2009

    Posted 30 Jun 2010 Link to this post

    Hi, im trying to process a file after downloading it, but the GetfileName and GetFilePath methos both are returning null values. The following is my ProcessRequest Override:

     public override void ProcessRequest(HttpContext context) 
     { 
         base.ProcessRequest(context); 
                
         string path = GetFilePath(); 
         string nome = GetFileName(); 
             
     
     } 

    Is this the right way or i'm doing something wrong?

    Thanks in advance
    Fred


  5. Fred
    Fred avatar
    45 posts
    Member since:
    Apr 2009

    Posted 05 Jul 2010 Link to this post

    Still the same error. Anyone with a response?


  6. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 06 Jul 2010 Link to this post

    Hi Fred,

    With the latest binaries the correct sytanx is:
    public class RadUploadHandler : Telerik.Windows.RadUploadHandler
    {
      
        public override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)
        {
            bool result = base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);
      
            if (this.IsFinalFileRequest())
            {
                string fileName = this.GetFileName();
                //// process the file.
            }
              
            return result;        
        }
    }

    Please let us know if you have more questions!

    Kind regards,
    Valentin.Stoychev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Fred
    Fred avatar
    45 posts
    Member since:
    Apr 2009

    Posted 06 Jul 2010 Link to this post

    It Worked, Thanks!

    Fred.
  8. Michael
    Michael avatar
    1 posts
    Member since:
    May 2010

    Posted 06 Jul 2010 Link to this post

    Is this code similar to what would need to be done to get http://www.telerik.com/support/kb/silverlight/upload/uploadhandler-uniquefilename.aspx this working correctly?  I used that link to rename the files before they are saved but it no longer appears to work with the latest binaries.

    Thanks
  9. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 09 Jul 2010 Link to this post

    Hello Michael,

    You can change the name of the file on the client side before saving it on the server if you handle the FileUploadStarting event of the RadUpload. More information on how to accomplish this you can find here.

    Give this approach a try and let me know if it works for you.

    Best wishes,
    Tina Stancheva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner