Forum OpenACS Q&A: Response to Inserting a image file in ORACLE

Collapse
Posted by Jun Yamog on

Hi JSvete,

I have emailed you with files and a short crude explanation. For the benefit of others here is the snippet of the short crude explanation on how to use CR.

The summary below is for uploading binary data to CR and putting the binary data to the file system.
1. Make a form with a enctype=multipart/form-data.
2. Use a input type=file form element
3. Submit the form to a tcl and get the file using ad_page_contact

upload_file:trim,notnull #the file name
upload_file.tmpfile:tmpfile #the tempfile that aol creates

4. Guess the mime_type and set it via ns_guesstype
5. Normally I create a plpgsql to do the following

5.a. Insert a new mime type to cr_mime_types if needed
5.b. create a new acs_object
5.c. create a new cr_items
5.b. create a new cr_revisions

6. Use cr_create_content_file to place the file on the file system
7. Updated cr_revisions with the correct file size and the file name that is created on the file system that is under content-respositorty-content-files

I hope this helps others in getting comfortable with CR.