[Zope] File uploading problems...

Donald Holten donner@biophysics.lanl.gov
Wed, 11 Aug 1999 08:52:53 -0600 (MDT)


I have the following upload DTML:
	<FORM METHOD="POST" 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