Forum OpenACS Development: Re: Uploading file from OpenACS to different OpenACS Server

Collapse
Posted by Dave Bauer on
It works fine, but util_http_file_upload can't login.

You'd need to have a form that accepted a secret key to securely use it. But it does generate a correct HTTP POST with a multipart form.

Okay, here is what I call:

util_http_file_upload -file /tmp/hello.odt -name "upload_file" http://cvs.cognovis.de:8080/contacts/convert

The convert page is not protected, feel free to get your PDFs generated the.

And here is the relevant part. If I go to http://cvs.cognovis.de:8080/contacts/convert and do a manual upload everything works fine. If I use my command above, it just returns the normal HTML page with the form.

ad_page_contract {
Download file, convert it to pdf and return it

@param url URL where to get the odt file from
} {
upload_file:trim,optional
return_url:optional
upload_file.tmpfile:tmpfile,optional
url:optional
}

ad_form -name "file-add" -html { enctype multipart/form-data } -export { folder_id lock_title_p name } -form {
{upload_file:file {label \#file-storage.Upload_a_file\#} {html "size 30"}}
} -after_submit {
set upload_files [list [template::util::file::get_property filename $upload_file]]
set oo_file [list [template::util::file::get_property tmp_filename $upload_file]]
}