I'm trying to set up a mail form that has file upload capabilities. I'm using the code below and it works, but one has to enter the filename manually to get it to show up by the attachment icon. Is there any way to have the file name automagically entered? <dtml-boundary type="application/octet-stream" disposition="attachment" encode="base64" filename_expr="doc_name"> <dtml-var expr="resume_file.read()"></dtml-mime> I know I can use filename_expr="resume_file.getId() if I'm using a document from Zope, but I would like an anonymous user to be able to use this as well. -- Michael Lewis
Michael writes:
I'm trying to set up a mail form that has file upload capabilities. I'm using the code below and it works, but one has to enter the filename manually to get it to show up by the attachment icon. Is there any way to have the file name automagically entered?
<dtml-boundary type="application/octet-stream" disposition="attachment" encode="base64" filename_expr="doc_name"> <dtml-var expr="resume_file.read()"></dtml-mime>
I know I can use filename_expr="resume_file.getId() if I'm using a document from Zope, but I would like an anonymous user to be able to use this as well. Hm.
Your problem is difficult to understand: Usually "getId" i callable by "Anonymous". Why are you worried? Usually, using a "MailHost" is protected quite heavily. You either must relax the protection (making your site open for email abuse) or use a Proxy role. But in the second case, you can use 'Manager' such that you can call any non-private method. So, what does not work? Dieter
On Wed, 16 Jan 2002, Dieter Maurer contacted me regarding: Re: [Zope] MailHost Question
Hm.
Your problem is difficult to understand:
Sorry I didn't explain it well. I'm having trouble understanding it myself.
Usually "getId" i callable by "Anonymous". Why are you worried?
It doesn't for me, see below:
Usually, using a "MailHost" is protected quite heavily. You either must relax the protection (making your site open for email abuse) or use a Proxy role.
I have the proxy set to Manager
So, what does not work?
For example, If I have a job posting board and you want to reply to a job which is posted on the site, and you use my mailform as is, the email would be sent, the attachment would be sent, but when the recipient sees the attachment, it will only say: [] Attachment: 1, no file name or type. This make it difficult for them to save it since they don't even know what type it is. <dtml-boundary type="application/octet-stream" disposition="attachment" encode="base64" filename_expr="resume_file.getId()"> <dtml-var expr="resume_file.read()"></dtml-mime> Does not work, I get an Attribute Error, "file upload instance has no attribute'getID' I then added an additional field to my form: doc_name, and changed the code to: <dtml-boundary type="application/octet-stream" disposition="attachment" encode="base64" filename_expr="doc_name"><dtml-var expr="resume_file.read()"></dtml-mime> This does work as long as the user manually enters the filename and type into the "doc_name" field on the form. My question is, is there any way to get the filename and type to appear on the recipients email without having to manually enter it? -- Michael Lewis "Linux - The final solution"
participants (2)
-
Dieter Maurer -
Michael