Home » Developer & Programmer » Forms » File Store and Copy in Directory
File Store and Copy in Directory [message #637174] Tue, 12 May 2015 05:06 Go to next message
mehboob110233
Messages: 53
Registered: February 2014
Location: Pakistan
Member

Dear all,
i store .FMX file in database for Release of the forms by using webutil library.
in database my column name is attached_file and database type is blob.
it work successfully.
now i want to some way where i can store these form in directory from database column
like 'd:\mehboob110\filename.FMX'

Kindly tell me about it.


Thanks.
Re: File Store and Copy in Directory [message #637175 is a reply to message #637174] Tue, 12 May 2015 05:17 Go to previous messageGo to next message
Michel Cadot
Messages: 65319
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You have to first create an Oracle directory for OS "d:\mehboob110" and this directory must reside on the database server.

Re: File Store and Copy in Directory [message #637177 is a reply to message #637175] Tue, 12 May 2015 05:25 Go to previous messageGo to next message
mehboob110233
Messages: 53
Registered: February 2014
Location: Pakistan
Member

Thanks Michel Cadot ,
Already created OS directory i just need syntax how can i copy these file from database item to OS directory.
Re: File Store and Copy in Directory [message #637178 is a reply to message #637177] Tue, 12 May 2015 05:34 Go to previous messageGo to next message
Michel Cadot
Messages: 65319
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You have to create an ORACLE directory to point to the OS one.
Then use UTL_FILE to write your BLOB into an OS file.

Re: File Store and Copy in Directory [message #637179 is a reply to message #637178] Tue, 12 May 2015 05:49 Go to previous messageGo to next message
mehboob110233
Messages: 53
Registered: February 2014
Location: Pakistan
Member

Kindly send me complete syntax
Thanks.
Re: File Store and Copy in Directory [message #637181 is a reply to message #637179] Tue, 12 May 2015 06:12 Go to previous messageGo to next message
Michel Cadot
Messages: 65319
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I could make the whole work for you but I prefer you search and try to do it then come back with your tries and solution or where you are stuck as I have also my own work to do.

Re: File Store and Copy in Directory [message #637211 is a reply to message #637181] Wed, 13 May 2015 01:22 Go to previous messageGo to next message
mehboob110233
Messages: 53
Registered: February 2014
Location: Pakistan
Member

Kindly guide me if anyone know this task
Re: File Store and Copy in Directory [message #637212 is a reply to message #637211] Wed, 13 May 2015 02:01 Go to previous messageGo to next message
Michel Cadot
Messages: 65319
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Why don't you try to do it?
What is your problem in doing it?
Where are you stuck?

Re: File Store and Copy in Directory [message #637216 is a reply to message #637212] Wed, 13 May 2015 03:53 Go to previous messageGo to next message
mehboob110233
Messages: 53
Registered: February 2014
Location: Pakistan
Member

I try to my best but not get solution.
i store my .FMX file in database column with column datatype successfully my next step is to copy this file from column to my directory like 'd:\mehboob'.
i use
CLIENT_IMAGE.WRITE_IMAGE_FILE('D:\MEHBOOB\'||:RELEASE_MANAGEMENT.OBJECT_NAME,'FMX','RELEASE_MANAGEMENT.ATTACHED_FILE', 0,0);
this package work properly when story image file like JPEG, when i use 'FMX' file this not work.
Re: File Store and Copy in Directory [message #637218 is a reply to message #637216] Wed, 13 May 2015 04:26 Go to previous messageGo to next message
Michel Cadot
Messages: 65319
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Did you try what I mentioned?
Did you notice my warning "this directory must reside on the database server"?

Re: File Store and Copy in Directory [message #637220 is a reply to message #637218] Wed, 13 May 2015 04:32 Go to previous messageGo to next message
mehboob110233
Messages: 53
Registered: February 2014
Location: Pakistan
Member

DECLARE
  V_COUNT NUMBER(2);
  V_DOC_TYPE VARCHAR2(10);
 BEGIN
  GO_BLOCK('RELEASE_MANAGEMENT');
  FIRST_RECORD;
  LOOP
  		IF :RELEASE_MANAGEMENT.ACTIVE='Y' THEN
  		
  		V_DOC_TYPE:=SUBSTR(:RELEASE_MANAGEMENT.OBJECT_PATH,(INSTR(:RELEASE_MANAGEMENT.OBJECT_PATH, '\'))+1, 10);
  		IF V_DOC_TYPE='FORMS\' THEN
  			:RELEASE_MANAGEMENT.DOC_TYPE:='FMX';
  		ELSIF V_DOC_TYPE='REPORTS\' THEN
  			:RELEASE_MANAGEMENT.DOC_TYPE:='RDF';
  		END IF;
  	:CONTROL.FILE_SOURCE_PATH := '\\VMWLSWD\DEVCOM\' ||
                                 :RELEASE_MANAGEMENT.OBJECT_PATH ||
                                 :RELEASE_MANAGEMENT.OBJECT_NAME||'.'||:RELEASE_MANAGEMENT.DOC_TYPE;
                                 
    PKG_FILE.UPDATE_DB_FILE(:OBJECT_CODE);
   [color=deeppink] CLIENT_IMAGE.WRITE_IMAGE_FILE('D:\MEHBOOB\'||:RELEASE_MANAGEMENT.OBJECT_NAME||'.'||:RELEASE_MANAGEMENT.DOC_TYPE,	[/color]:RELEASE_MANAGEMENT.DOC_TYPE,'RELEASE_MANAGEMENT.ATTACHED_FILE', 0,0);
  -- client_image.write_image_file(vfilename,'','COMPANY_INFO_MST.CIM_LOGO'); 
    --
    END IF;
     EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
  
    NEXT_RECORD;
  END LOOP;

END;


This is my code first i upload file in database now i want to copy that file in any directory
i use color line for that
Re: File Store and Copy in Directory [message #637457 is a reply to message #637220] Mon, 18 May 2015 07:09 Go to previous messageGo to next message
mehboob110233
Messages: 53
Registered: February 2014
Location: Pakistan
Member

Succussfully Copy File from database to os directory.
Thanks to All.
Re: File Store and Copy in Directory [message #639807 is a reply to message #637457] Thu, 16 July 2015 08:47 Go to previous messageGo to next message
pooja.bawankar
Messages: 1
Registered: February 2015
Location: Nagpur
Junior Member
hi mahboob,
please help me out to save fmx in database through oracle form 10g with coding example
Re: File Store and Copy in Directory [message #639840 is a reply to message #639807] Fri, 17 July 2015 10:51 Go to previous message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
You're not following Michael's suggestion!
Quote:
CLIENT_IMAGE.WRITE_IMAGE_FILE('D:\MEHBOOB\'||:RELEASE_MANAGEMENT.OBJECT_NAME,'FMX','RELEASE_MANAGEMENT.ATTACHED_FILE', 0,0);
this package work properly when story image file like JPEG, when i use 'FMX' file this not work.

Why are you surprised this doesn't work? WRITE_IMAGE_FILE is for writing compatible IMAGE files not any type of BINARY file.

Is "D:\mehboob110" a directory on your computer or on the Database server computer? If it is a directory on your computer, you can use the WebUtil_File.DB_TO_CLIENT function to transfer the file from the database to the directory on your computer.

If the directory is on the Database server, then you need to use Michel's suggestion of creating a DIRECTORY object in the database and then use the database package UTL_FILE to write the file form your table to the server directory.

As Michel stated, we're not going to write the code for you but we'll happily help you fix your code. Smile

Craig...
Previous Topic: FRM-40350: Query Caused no record to be Retrived.
Next Topic: Which Trigger?
Goto Forum:
  


Current Time: Tue Jan 23 19:09:31 CST 2018

Total time taken to generate the page: 0.01562 seconds