Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: BLOB's in Web page

Re: BLOB's in Web page

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Tue, 12 Mar 2002 12:50:03 +0300
Message-ID: <a6kite$aks$1@babylon.agtel.net>


Read the mod_plsql docs on File Upload/Download. You can access the docs from the Administrative Gateway (click on the Help link in the upper-right corner of the screen - this will bring up the manual). In a few words:

  1. You need to set up a Document Access Path and Document Access Procedure in your DAD. For example, if your doc access path is 'docs/' then requests like http://server/pls/your_dad/docs/somefile.jpg will be processed this way: the mod_plsql will detect the document access path, will cut everything past it (somefile.jpg will be left) and call your document access procedure passing the leftover as the only varchar2 parameter.
  2. Your document access procedure will accept the requested file name. It should generally use wpg_docload.download_file procedure to return the content. Sample procedure is included in the docs - you may extend it to feed BLOBs or BFILEs from different tables depending on additional prefixes (for example, a request to http://server/pls/your_dad/docs/images/image.jpg will pass 'images/image.jpg' to your procedure - you will see the images/ prefix and feed the content from, say, images table. Different prefix - another table. You can even generate content on the fly, put it into BLOB and feed it with wpg_docload!
  3. You can also set up the document upload table - it has to have at least the mandatory fields outlined in the docs. All <input type=file> form fields will go into this table. Good thing about this table is that it is also used as default source for files download if you do not specify the document access procedure. That is, on request to /pls/your_dad/docs/file.ext mod_plsql will try to locate the file.ext in your document table automatically if there is no document access procedure that modifies this default behavior and serves from different sources. Limitations of this approach: one table serves all, no preprocessing/logging is done, you can't generate files on the fly, etc.

Read the documentation for more details on these things. And install the latest patch for mod_plsql and OWA toolkit to get rid of the many bugs (including security holes) in both.

hth.

--
Vladimir Zakharychev (bob@dpsp-yes.com)                http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.


"Jason Craig" <jascraig_at_hotmail.com> wrote in message
news:f310a7ab.0203112347.7f6b3932_at_posting.google.com...

> We're working to get a BLOB from our db into a web page via a stored
> pl/sql procedure. How do we accomplish this? Right now we're
> considering using a varchar2 as a pointer to the file. Here's a look
> at our code using a file only (not using the DB):
> procedure HOME
> is
> begin
> htp.htmlopen;
> htp.headopen;
> htp.title('wise home page');
>
> htp.p('<META HRRP-EQUIV="Expires" CONTENT="Mon, 12 Mar
> 2002 17:45:00 GMT">');
> htp.p('</META>');
> htp.headclose;
> htp.bodyopen;
> htp.header(1, 'EKBD');
> htp.header(1, 'Welcome to WISE. Where you will Screech
> if you do not get
> Hooters!');
> htp.tableOpen(cattributes => 'ALIGN ="center"');
> htp.tableRowOpen;
> htp.tableData(htf.img2('owl.jpg', cattributes =>
> 'height="259" width="259"'));
> /*'/u01/app/oracle/product/9.0.1/Apache/Apache/htdocs/owl.jpg'
> */
> htp.tableRowClose;
> htp.tableClose;
> htp.bodyclose;
> htp.htmlclose;
> end;
>
> We want to put the owl.jpg into the DB in a BLOB column, but how do we
> extract it? We're using 9i with all the develop software.
>
> Any help would be appreciated. Please e-mail me:
> jascraig_at_hotmail.com.
>
> Thanks,
> Jason
Received on Tue Mar 12 2002 - 03:50:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US