[Product-Developers] File saving with PloneFormGen in MySQL

bad_my84 bas.roijen at gti-group.com
Thu Nov 13 09:56:36 UTC 2008




Andreas Jung-5 wrote:
> 
> On 13.11.2008 10:41 Uhr, bad_my84 wrote:
>> The problem is that I don't know how I can add a file via the 'File
>> field'
>> into the database.
>>
>> With strings&  integers I use the 'ZSQL Method' with:
>> INSERT INTO tabel VALUES(
>>    <dtml-sqlvar voornaam type=string>,
>>    <dtml-sqlvar achternaam type=string>
>> )
>>
>> But what kind of type should I use for a file? Or isn't it that ease?
> 
> No idea about MySQL but a blob-ish type is likely the right choice.
> You have to check your MySQL documentation how to insert binary data 
> into a blob. This is not a Zope issue since Zope generates only the SQL
> _you are writing_. If you upload a file you should be able to get hold 
> of the binary data of the file through something like
> 
> binary_data = context.REQUEST['name-of-file-field'].read()
> 
> -aj
> 
> begin:vcard
> fn:Andreas Jung
> n:Jung;Andreas
> org:ZOPYX Ltd. & Co. KG
> adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
> email;internet:info at zopyx.com
> title:CEO
> tel;work:+49-7071-793376
> tel;fax:+49-7071-7936840
> tel;home:+49-7071-793257
> x-mozilla-html:FALSE
> url:www.zopyx.com
> version:2.1
> end:vcard
> 
> 
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
> 
> 

Thanks, now I know how to get the binary data!
-- 
View this message in context: http://n2.nabble.com/File-saving-with-PloneFormGen-in-MySQL-tp1493368p1493447.html
Sent from the Product Developers mailing list archive at Nabble.com.





More information about the Product-Developers mailing list