[Zope] adding a file upload to an email
J Cameron Cooper
jccooper at jcameroncooper.com
Thu Jan 29 18:56:08 EST 2004
Matt Carey wrote:
> i have a simple form, where the results get sent out as an email. the
> form is within a dtml file, and the form method calls another dtml
> file which has the sendmail part. it all works fine.
>
> but i need to add a file upload to the form, and have it send the
> attached file with the rest of the form results via email. so i have
> in my form:
>
> <input size="20" value="" type="file" name="upload" />
>
> and then in my dtml file:
>
> <dtml-try>
> <dtml-sendmail mailhost="MailHost">
> To: xxx
> From: xxx
> Subject: test form
>
> <dtml-var upload>
>
> </dtml-sendmail>
>
> but the email i get back gives me this:
> <ZPublisher.HTTPRequest.FileUpload instance at 0x8c09bcc>
First, you'll need to learn about MIME types and mail and the dtml-mime
tag. This should help:
http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.17.html
Then you'll also need to know how to get the contents of a File object:
http://mail.zope.org/pipermail/zope/2003-May/136380.html
Also check out this thread:
http://lists.imeme.net/archives/imeme-users/2000-September/000097.html
--jcc
--
"Code generators follow the 80/20 rule. They solve most of the problems, but not all of the problems. There are always features and edge cases that will need hand-coding. Even if code generation could build 100 percent of the application, there will still be an endless supply of boring meetings about feature design."
(http://www.devx.com/java/editorial/15511)
More information about the Zope
mailing list