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

Process the file once it's uploaded

7 Answers 123 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Wayne Bradney
Top achievements
Rank 1
Wayne Bradney asked on 09 May 2010, 12:49 AM
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.

7 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 09 May 2010, 08:04 PM
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.
0
Fred
Top achievements
Rank 1
answered on 30 Jun 2010, 03:39 PM
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


0
Fred
Top achievements
Rank 1
answered on 05 Jul 2010, 01:58 PM
Still the same error. Anyone with a response?


0
Valentin.Stoychev
Telerik team
answered on 06 Jul 2010, 10:31 AM
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
0
Fred
Top achievements
Rank 1
answered on 06 Jul 2010, 01:58 PM
It Worked, Thanks!

Fred.
0
Michael
Top achievements
Rank 1
answered on 06 Jul 2010, 09:24 PM
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
0
Tina Stancheva
Telerik team
answered on 09 Jul 2010, 05:09 PM
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
Tags
Upload
Asked by
Wayne Bradney
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Fred
Top achievements
Rank 1
Valentin.Stoychev
Telerik team
Michael
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or