Forum OpenACS Development: Re: uploading files

Collapse
2: Re: uploading files (response to 1)
Posted by Peter Alberer on

in the html file where you provide the form you need something like that:

<form enctype=multipart/form-data method=POST action='upload_processor.tcl'>
<b>Filename</b>
<input type=file name=upload_file size=20>
<input type=submit value='Upload'>
</form>

In the tcl file that accepts the uploaded file (the "action" in the form of the html page, upload_processor.tcl in my example) you need those two lines in your page contract:

upload_file:notnull,trim = the name of the file the user provided
upload_file.tmpfile:tmpfile = the path to the uploaded file on the web server, typically something in the /tmp directory

hope that helps