OpenACS already has file uploading built in (assuming you're using the OpenACS form builder aka ad_form, template::form - it has many names!). The specific widget you need to use is template::widget::file
A worked example is in the General Comments package (see file-ae.adp, file-add.tcl and file-add-2.tcl): http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-ae.adp?r=1.6 http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-add.tcl?r=1.4 http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-add-2.tcl?r=1.6
Specifically, look out for the 2 ad_page_contract parameters, and follow those variables down through the code:
upload_file:notnull
upload_file.tmpfile:tmpfile