Search code examples
c#asp.netasp.net-mvcasp.net-mvc-4uploadify

HTTP ERROR (404) with uploadify and custom uploader for asp net [ASP NET MVC 4]


I need to implement uploadify on my asp net mvc 4 application.

I have replaced the uploadify.php with this simple class just for test purpose:

public class uploadify : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        HttpPostedFile oFile = context.Request.Files["Filedata"];

        oFile.SaveAs("C:\\" + oFile.FileName);
    }

    public bool IsReusable
    {
        get { return false; }
    }
}

And the config is like that:

$('#file_upload').uploadify({
    'swf': '../../Components/uploadify/uploadify.swf',
    'uploader': '../../Scripts/uploadify/uploadify.cs',
    'auto': false,
    'buttonText': 'Selecionar',
    'debug': true
});

I am getting a HTTP ERROR (404) The path for the uploadify.cs is correct so I don´t see why this resource is not found.


Solution

  • If you are doing the site in MVC 4, why not just use a controller instead of an IHttpHandler?

    Example of 'How do I get jQuery's Uploadify plugin to work with ASP.NET MVC?'