[Zope] File uploading problems...
Thomas Weiner
weiner@tu-harburg.de
Wed, 11 Aug 1999 17:11:31 +0200
Donald Holten schrieb:
>
> I have the following upload DTML:
> <FORM METHOD="POST" ACTION="resultpage">
Try <FORM METHOD="POST" Enctype="multipart/form-data"
ACTION="resultpage">.
> Data File:<INPUT TYPE="FILE" NAME="data" SIZE="20">
> <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="SUBMIT">
> </FORM>
>
> And the following result page:
> <!--#var "resultstuff(data=data)" -->
>
> And the following python file resultstuff:
> #! /usr/local/bin/python
> def resultstuff(data):
> import os, shutil
>
> # Variables:
> returnstring = "" # The messages this page
> # will print out.
>
> if data.read(1) == '':
> returnstring = "<H2> File does not exist</H2>"
> else:
> data.seek(0)
> for element in file.readlines():
> returnstring = returnstring + element
> return returnstring
>
> I get the following error:
> Error Type: AttributeError
> Error Value: 'string' object has no attribute 'read'
>
> The traceback says it's from line 9 of the program, which is:
> if data.read(1) == '':
>
> Is Zope converting my file to a string or something? Is there some way
> to fix this? Thanks!
> Donner
>
Regards,
thomas
--
fon: ++49 (0)40 42878 3781
fax: ++49 (0)40 42878 2728