Michael Bleijerveld wrote at 2003-8-19 16:44 +0200:
I want to upload a file with this form.
<FORM ACTION="upload_file" METHOD="POST" ENCTYPE="multipart/form-data">
<INPUT TYPE="FILE" NAME="FILE" > <INPUT TYPE="SUBMIT" VALUE="Upload" NAME="ACTION" >
</FORM>
To check the size with os.path.getsize(file) I need the filename with the whole path.
How can I get this from the form variables ?
Others already told you that the client side file path will not help you (as, in general, you will not be able to access the file). When Zope starts to handle your request, ZServer has already uploaded your complete file to a temporary file on your server. Depending on the file size, this can take quite long. You can use the file methods "seek(0,2)" (positions at the end of the file) and "tell()" (returns the current position) to determine the files size. Do not forget to reposition at the start of the file ("seek(0") when you want to process it. Dieter