cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Light <rich...@light.demon.co.uk>
Subject Uploading files: further issues
Date Wed, 20 Sep 2006 17:13:08 GMT

Hi,

I am making some progress with my attempts to use the
FileUploadsWithFlow code in the Wiki.  However, I'm now stuck.

Two little problems which I managed to fix are that:

1. the match pattern in the sitemap needs to be:

 <map:match pattern="upload">
    <map:call function="upload"/>
   </map:match>
not:
 <map:match pattern="/upload">
    <map:call function="upload"/>
   </map:match>

for it to match, and

2. "JavaScript" in the <map:flow> element is case-sensitive, i.e.

<map:flow language="JavaScript">
    <map:script src="upload.js" />
  </map:flow>
not:
<map:flow language="javascript">
    <map:script src="upload.js" />
  </map:flow>

The second of these issues may be caused by my having a non-standard
setup, though I don't remember altering the <flow-interpreters> element
in cocoon.xconf.

The problem is in executing my little JavaScript program:

var role = 'org.apache.cocoon.components.upload.FileUploadManager';

   function upload() {
      var uploader = cocoon.getComponent(role);
      var part = cocoon.request.get("upload-file");
      try {
        uploader.upload (part);
        cocoon.sendPage("success.html");
      } catch (Exception) {
        cocoon.sendPage("failure.html");
      }
   }

I get an internal server error: "getComponent is not a function".

If I comment out this line, I get an error message "sendPage is not a
function".  So the interpreter is happy with cocoon.request.get, but not
these two commands.  Any thoughts on what I need to set up or change to
get this to work?

Thanks,

Richard Light

-- 
Richard Light
SGML/XML and Museum Information Consultancy
richard@light.demon.co.uk


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message