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

Custom File Handler problem

1 Answer 134 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Lighthouse Developer
Top achievements
Rank 1
Lighthouse Developer asked on 21 Jul 2010, 11:50 AM
Hi,
I have a question/problem about implementing my own  handler.
I have follow the image uploader example in the demo but is seems that I cant get my handler to work.
To be more specific,if I have not set the radupload to use my handler it works as expected.
If I set it to use my handler (HttpHandlerUrl="~/CustomUploaderHandler.ashx") the uploading animation its always displayed and the file
isnt uploaded.One more thing is that I have set a breakpoint inside the Process method of the Handler but its not hitted.
Am I missing some configuration that is not mentioned in the demo?

the HttpHandler code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Telerik.Web.UI;
 
namespace UploaderTest
{
    public class CustomUploadHandler : AsyncUploadHandler, System.Web.SessionState.IRequiresSessionState
    {
 
        protected override IAsyncUploadResult Process(UploadedFile file, HttpContext context, IAsyncUploadConfiguration configuration, string tempFileName)
        {
            base.Process(file, context, configuration, tempFileName);
CustomAsyncUploadResult result = CreateDefaultUploadResult<CustomAsyncUploadResult>(file);
 
            return result;
        }
 
         
 
    }
}

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 27 Jul 2010, 01:52 PM
Hello,

You should verify that your custom handler compiles correctly by accessing it directly:

http://myapp/Path/Handler.ashx

In your case the CustomAsyncUploadResult type is not defined. The example uses the following custom type to return the ImageID to the page:

public class SampleAsyncUploadResult : AsyncUploadResult
{
    private int imageID;
 
    public int ImageID
    {
        get { return imageID; }
        set { imageID = value; }
    }
}

I hope this helps.

Kind regards,
Tsvetomir Tsonev
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
AsyncUpload
Asked by
Lighthouse Developer
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or