Hi,

you forgot the enctype attribute in your form definition.
Here is the line from the example page:
<form action="FileUpload.py" method=POST enctype="multipart/form-data">

Without the 'enctype="multipart/form-data"' definition, the server doesn't 
know that a file is coming in and treats the field as a string.
By the way, this has nothing to do with Python, Webware or any other 
programming environment. That's HTTP.

Stephan

On Friday 03 October 2003 12:38, Thomi Richards wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Hi,
>
> I looked at the example file upload page (which didn't work), copied it...
> and guess what?? the copied one idn't work either ;P
>
> now I have to find out why, and I've arrived at this:
>
> in the example (FileUpload.py), in fileupload(self,trans):
>
> the line: "contents = f.file.read()" suggests that f.file is a standard
> python file object (or something like it), but on my version, f is a string
> object, and that's why both the example and my attempts are failing..
>
> has anyone else come across this? I'm just starting with webware, and need
> a few pointers... here's the (short) page source:
>
> - ----<snip>----
> from Main import Main
>
>
> class dev_artists(Main):
>         def writeContent(self):
>                 self.writeln('''<h2>Artists:</h2>
>                 This page is for the use of artists who would like to
> submit artwork to the once project. To submit work, please fill out the
> following form:
>                 <br><br>
>                 <form action="dev_artists.py" method="POST">
>                 <table>
>                         <tr><td>Artist name:</td><td><input type="text"
> name="artist_name"></td></tr>
>                         <tr><td>Filename:</td><td><input type="FILE"
> name="filename"></td></tr>
>                         <tr><td>Description of file:</td><td><input
> type="text" name="file_description"></td></tr>
>                 </table>
>                 <input type="submit" name="_action_" value="fileupload">
>                 </form>
>                 ''')
>         def fileupload(self,trans=None):
>                 artist = self.request().field('artist_name')
>                 f = self.request().field('filename')
>                 description = self.request().field('file_description')
>
>                 self.writeln(f)
>
>         def actions(self):
>                  return Main.actions(self) + ['fileupload']
> - ----</snip>----
>
> The Main class is itself a subclass of SideBarPage, and doesn't overwrite
> any functions other than a few needed for generating HTML output, such as
> writeContent, writeSideBar, and writeStyleSheet.
>
> Can someone help me diagnose this problem?
>
> THanks,
>
> - --
> Thomi Richards,
> http://once.sourceforge.net/
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
>
> iD8DBQE/fVGI2tSuYV7JfuERArM9AKCI8/Q96enn4/LEmABX29CqY7vxUQCeJ20W
> kNrEFYSho/Zt0Ov+MCUypvc=
> =vPZU
> -----END PGP SIGNATURE-----
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to