Forum OpenACS Development: uploading files

Collapse
Posted by Paul Owen on
Hello, I would like to use the content from an uploaded file, with the path provided by

<form name=upload action=upload2>
Path: <input type=file name=filepath>
</form>

Any hints?
Thanks
paul

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