views:

7164

answers:

4

I am using Uploadify and something which was previously working now isn't and I'm not sure why. I get an HTTP error returned whenever I click upload. Watching the net tab in Firefox, it doesn't look like it's even sending anything to the server again.

I've tried putting in the error function to help debug but the status attribute is undefined..

$("#fileInput").uploadify({
                'uploader': '/scripts/upload/uploadify.swf',
                'script': '/Member/UploadImages/PerformUpload',
                'cancelImg': '/scripts/upload/cancel.png',    
                'multi': true,
                'simUploadLimit': 1,
                'fileDesc': "Images",
                'fileExt': "*.jpg;*. jpeg;*.bmp;*.png",
                'sizeLimit': 3000000,
                'onAllComplete':showFinishedLink,
                'onError': function (event, queueID ,fileObj, errorObj) {
                    var msg;
                    if (errorObj.status == 404) {
                       alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
                       msg = 'Could not find upload script.';
                    } else if (errorObj.type === "HTTP")
                       msg = errorObj.type+": "+errorObj.status;
                    else if (errorObj.type ==="File Size")
                       msg = fileObj.name+'<br>'+errorObj.type+' Limit: '+Math.round(errorObj.sizeLimit/1024)+'KB';
                    else
                       msg = errorObj.type+": "+errorObj.text;
                    alert(msg);
                    $("#fileUpload" + queueID).fadeOut(250, function() { $("#fileUpload" + queueID).remove()});
                    return false;
                    },
            });

Any ideas?

+3  A: 

OK, figured out that the error debugging I was using was old and that I can say errorObj.info to get out the more detailed info on why it's not working.

Did this and turns out it's a 404 which means the script I'm attempting to POST to isn't being picked up even though it does exist. Sounds like a routing issue...

Case closed!

Graeme
+2  A: 

Just to add more info on this - the 404 was as a result of an old default Login url in the web.config file.

Once I fixed this, the 404 then became a 302 (looking at the IIS logs) as the site was redirecting me to the login page.

My upload script is in an authenticated area of the site and so I needed to use something which is described in this site

Using flash with aspnet mvc

Graeme
Thanks for posting your follow-up. I was having the same problem and was a little stumped for a bit.
digitaldreamer
A: 

What if the errorObj.status comes back as undefined? What does that mean? I have been stuck with this for two weeks already and cannot seem to resolve the issue. I'm using Uploadify on asp.net 3.5.

Krummelz
A: 

I have the same issue with a Java spring application. If I clean and redeploy the application on tomcat, the upload works only once. Then the annoying 302 messages come back.

Costa