cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Howard <coc...@leverageweb.com>
Subject Re: File upload with flow (Wiki examples)
Date Mon, 15 Sep 2003 13:28:44 GMT
Stephen Ramsay wrote:
> On Sun, Sep 14, 2003 at 10:01:05PM -0400, Geoff Howard wrote:
> 
>>Stephen Ramsay wrote:
>>
>>>On Sun, Sep 14, 2003 at 08:33:01AM -0400, Geoff Howard wrote:
>>>
>>>>Aha!  That wiki example has a problem I just noticed -- you shouldn't 
>>>>return null here (I just corrected the wiki).  Use the corrected version 
>>>>above - I'll explain below.
> 
> Well, Geoff, I just can't get it to work.  I'm no longer getting
> 404s, but it's still not uploading the file.

How do you know?  By default, the servlet cleans up the file at the end 
of the request (I think -- it didn't used to be this way, but I think 
this was done when this was refactored to address some security 
concerns).  So, unless you are reading your debug statements (which it 
seems you're not getting) you wouldn't know.

> If you can stand it any longer, here's the rundown on what I've got.
> 
> First, the necessary switches have been turned on in web.xml:
> upload-enabled is true, and the upload directory has been created (and enabled) with
write permission for all.

What is autosave-uploads set to?  I'm assuming it's true, or you'd be 
getting a class cast exception.

...

> 
> 			Part filePart = (PartOnDisk) request.get("uploadfile");

This is the reason I'm asking.  The way this is written, it is hardcoded 
to assume PartOnDisk, which is only going to be the case when 
autosave-uploads is true.  When false, you will get a PartInMemory. 
It'd be better there to cast to Part and rely on polymorphism or to 
check which you have first if you want to get a java.io.File when 
available from PartOnDisk.

> 				getLogger().debug("Uploaded file = " + filePart.getFileName());
> 
> 			} else {
> 
> 				getLogger().debug("File not found");

...

> I'm making some kind of progress; when I hit upload it fires off the
> success page.  However, there's still no file, and more crucially,
> no log.

As I mentioned before, you need to check what log level is set in 
logkit.xconf for the sitemap target - it's probably ignoring DEBUG by 
default.

> I'm probably going to hack away at it for another session or so
> (using some ideas from the code you sent), but it's really not
> looking good . . .

Trust me, file uploads work all the time.  I am using them regularly in 
a live deployed project.

...

> One last thing, though.  I am runnning tomcat (on Linux) using the
> mod_jk module for Apache.  Would this make any difference?  I can't
> think of why it would (mod_jk is a pretty straightforward pass-it-on
> type thing, and it works fine for the rest of my cocoon stuff), but
> I thought I'd mention it . . .

No, don't think this has any relation.  For the record, the project I 
just mentioned is using mod_jk.

Geoff



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


Mime
View raw message