Nitesh
Nitesh

Reputation: 2337

HTTP 405 Error when uploading files using uploadify in ASp.Net on webserver

I am using uploadify jQuery plugin form here.

Everything works fine on my local PC and I ahve written a pretty simple ASHX handler to handle the fiel and save it onto disk and insert into DB. When I upload the code to server(Win 2K8) after publishing, it is returning a HTTP Error with code 405. I tried to figure out the issue but am unable to do so. I have also handled my handler code in try-catch blocks and log exception into DB so if any exception takes place at server end, it will be logged into DB. When the error appeared, I checked the database, but no records where inserted. Any idea on what could be the problem and how to resolve this.

Update 1

Here is the code to post:

<script type = "text/javascript">
    $j(window).load(function () {
        $j("#<%=FileUpload1.ClientID %>").uploadify({
            'uploader': 'js/uploadify.swf',
            'cancelImg': 'images/cancel.png',
            'buttonText': 'Browse Files',
            'script': 'Upload.ashx?id=<%=Request.QueryString("ID") %>',
            'folder': 'p',
            'fileDesc': 'Image Files',
            'fileExt': '*.jpg;*.jpeg;*.gif;*.png;',
            'multi': true,
            'auto': true,
            'onComplete': function (l, i, k, j, m) { alert(j); },
            'onError': function (m, i, l, k) { alert(k.type + ":" + k.info); },
            'onAllComplete': function (event, data) {
                alert('Files have been uploaded successfully!Please refresh page to see the latest images.');
            }
        });
    });

Upvotes: 0

Views: 3873

Answers (1)

Chris Fulstow
Chris Fulstow

Reputation: 41882

You probably need to configure IIS to allow POST requests for the .ashx file extension.

See: How to Resolve an HTTP 405 Resource not allowed Error in IIS

Upvotes: 1

Related Questions