[Zope] how to upload text?
Hannu Krosing
hannu@tm.ee
Mon, 06 Dec 1999 09:42:35 +0200
John Edstrom wrote:
>
> I want to make a form where a variable can take input either from a
> textarea form element, or from a file upload. I've seen some things
> about how to upload files, but I don't want to save the data as files, I
> want to load it into a textarea form element where it can be edited if
> needed and then it will be saved in a database.
>
> Is there an example or a recipe to do this anywhere?
The minimal example (constructed by consulting the source code
of management frames):
uploader:
------------------------
<!--#var standard_html_header-->
<FORM ACTION="editor" METHOD="POST"
ENCTYPE="multipart/form-data">
<INPUT TYPE="file" NAME="file:string" SIZE="25" VALUE=""><br>
<INPUT TYPE="SUBMIT" VALUE=" Add ">
</FORM>
<!--#var standard_html_footer-->
------------------------
editor
------------------------
<!--#var standard_html_header-->
<FORM ACTION="processor" METHOD="POST">
<TEXTAREA NAME="text" ROWS=7 COLS=65><!--#var file--></TEXTAREA><br>
<INPUT TYPE="SUBMIT" VALUE=" Add ">
</FORM>
<!--#var standard_html_footer-->
------------------------
You upload a file using 'uploader' to 'editor', then submit
the contents to 'processor' (not shown, do whatever you want ;)
after editing.
The :string at end of file:string forces it to string of file contents,
you still need the form encoding type of "multipart/form-data" for file
uploads to work
--------------------
Hannu Krosing