You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gerhard Hipfinger <ge...@openforce.at> on 2002/06/06 01:31:34 UTC
multipart/forms binary upload in mysql
Hi!
Has anyone successfully configured mysql to store binary data in blob
fields?
As soon as I try to upload e. g. an image I get an
_org.apache.cocoon.ProcessingException:
Could not add record: java.io.FileNotFoundException:
org.apache.cocoon.components.request.multipart.FilePartFile@2bfa91
(Datei oder Verzeichnis nicht gefunden)_
The file itself is correctly uploaded in the upload-dir
I used the howto from
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=101468178609584&w=2
but only getting the error above.
Anyone out there who can confirm mysql troubles?
Regards,
Gerhard
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: multipart/forms binary upload in mysql
Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 06.Jun.2002 -- 06:56 AM, Andrew Timberlake wrote:
> Gerhard
>
> I think that your problem is not mysql but the use of the
> DatabaseAddAction.
> Looking through the source for the DatabaseAddAction indicates no
> awareness of Uploaded Files.
> The error you are receiving below shows that cocoon is correctly
> retrieving your file and placing it in a FilePartFile object but the
> DatabaseAddAction is retrieving the data through request.getParameter()
> which only returns a string showing you the toString() results of the
> FilePartFile object.
> If you handle the database work in your own action you will have no
> problem adding the binary data (Correction: using mysql's default
> limits, you will only be able to store 1M of information (Change
> max_allowed_packet if you need more)).
>
> You should be able to write a small action which reads the FilePart and
> places the actual file into a request Attribute.
And if you were using the "new" database actions (scratchpad in 2.0.3,
o.a.c.acting.modular package in HEAD), you would just write your custom
"InputModule" (o.a.c.components.modules.input) which is *really*
simple. Ahem, well, currently the setColumn method does not allow to
provide an InputStream or a Reader to it but that would be POC to
change.
Chris.
--
C h r i s t i a n H a u l
haul@informatik.tu-darmstadt.de
fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: multipart/forms binary upload in mysql
Posted by Andrew Timberlake <an...@timberlake.co.za>.
Gerhard
I think that your problem is not mysql but the use of the
DatabaseAddAction.
Looking through the source for the DatabaseAddAction indicates no
awareness of Uploaded Files.
The error you are receiving below shows that cocoon is correctly
retrieving your file and placing it in a FilePartFile object but the
DatabaseAddAction is retrieving the data through request.getParameter()
which only returns a string showing you the toString() results of the
FilePartFile object.
If you handle the database work in your own action you will have no
problem adding the binary data (Correction: using mysql's default
limits, you will only be able to store 1M of information (Change
max_allowed_packet if you need more)).
You should be able to write a small action which reads the FilePart and
places the actual file into a request Attribute.
I refer to the setColumn method in AbstractDatabaseAction which looks
for form elements in the following sequence:
<snip>
Object value = request.getParameter(param);
if (value == null) value = request.getAttribute(param);
if (value == null) value = request.get(param);
</snip>
Here it will locate the uploaded file through the getParameter so it
won't keep checking.
I would use a different name for the form field than actually used in my
HTML form and then I would read the FilePart in my own action saving the
File into a request attribute using the field name specified to the
DatabaseAddAction which will cause the DatabaseAddAction to find the
File in the request.getAttribute in the code above.
I hope this helps a little.
Andrew
On Thu, 2002-06-06 at 01:31, Gerhard Hipfinger wrote:
> Hi!
>
> Has anyone successfully configured mysql to store binary data in blob
> fields?
>
> As soon as I try to upload e. g. an image I get an
> _org.apache.cocoon.ProcessingException:
> Could not add record: java.io.FileNotFoundException:
> org.apache.cocoon.components.request.multipart.FilePartFile@2bfa91
> (Datei oder Verzeichnis nicht gefunden)_
>
> The file itself is correctly uploaded in the upload-dir
>
> I used the howto from
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=101468178609584&w=2
> but only getting the error above.
>
> Anyone out there who can confirm mysql troubles?
>
> Regards,
> Gerhard
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: multipart/forms binary upload in mysql
Posted by John Austin <jo...@integerservices.no-ip.com>.
On Wednesday 05 June 2002 07:31 pm, you wrote:
I use PostgreSQL but use a Blob. There is a note somewhere in the
Momjian book to the effect that it is easy to get file perms problems.
Remember that the file will be read by the database engine with the
effective userid of the database engine not the id used by your Servlet
container to generate and submit the SQL statements.
> Has anyone successfully configured mysql to store binary data in blob
> fields?
>
> As soon as I try to upload e. g. an image I get an
> _org.apache.cocoon.ProcessingException:
> Could not add record: java.io.FileNotFoundException:
> org.apache.cocoon.components.request.multipart.FilePartFile@2bfa91
> (Datei oder Verzeichnis nicht gefunden)_
>
> The file itself is correctly uploaded in the upload-dir
>
> I used the howto from
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=101468178609584&w=
>2 but only getting the error above.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>