[RESOLVED]How to post to a handler from Fileupload


I am creating an Image gallery as described in the book Beginning ASP.NET Web Pages. It works great. However, I would like to implement it using an HTTPHandler as I am planning on integrating it with my project that uses Handlers. The Fileupload helper creates
it’s own upload form so I can’t specify an action attribute to it like I can with normal forms. How would I go about doing this? Thanks.

Use a normal form instead of the file upload helper. The only benefit the file upload helper offers over input type="file" is a simple way to add multiple file uploads. Or use jQuery to change the action attribute of the form when the submit button is clicked:

$(function () {
    $('input[type="submit"]').on('click', function () {
        $(this).closest('form').attr('action', '/myHandler.ashx');

Leave a Reply