Struts 2 and YUI Uploader issues

560 views Asked by At

I have a project that I'm working on where we need to be able to select multiple files for upload at one time. Since we already use YUI for several other things this seemed to be an fairly simple request. I did some research and decided to use YUI's Uploader to do the work.

Built a simple example to get familiar with the component. The simple example was a JSP using YUI Libraries connecting to a Servlet using org.apache.commons.fileupload to handle the files. Worked flawlessly. So I moved on to integration into our struts 2 project. Everything works great until you try to upload then it does nothing. So I tried several things and here is what I found.

If I code the upload function for YUI like this

function upload() { //alert("upload; fileID=" + fileID);

                 if(fileID !=null)
                 {
                   uploader.uploadAll( "http://localhost:8080/YUIUploaderTest/uploader","POST");
                 }

             }

It works perfectly. Files are upload and created and the masses rejoice.

If however I change it to what it should be for the production environment

function upload()
             {
                 //alert("upload; fileID=" + fileID);

                 if(fileID !=null)
                 {
                   uploader.uploadAll( "/ECMS/certificate/massimportcertificate_uploadFiles.action","POST");
                 }

             }

it does nothing except throw up a #2038 error from flash. After much googling I thought that perhaps the url I'm trying to pass is just incorrect. But if I put that url in my browser with the http://localhost:8080/ attached to it it fires off the action.

The question is, what is causing this 2038 error? Is there something in struts that needs to be configured before the YUI uploader will work?

Thanks!

1

There are 1 answers

0
Pav On

You need to specify an absolute path. Giving a relative path wont work. Hope this helps!