Home » Developer & Programmer » Forms » How to copy image from one folder to another using Oracle Form 6i (Oracle Form 6i, XP)
How to copy image from one folder to another using Oracle Form 6i [message #598303] Sat, 12 October 2013 12:39 Go to next message
dark_prince
Messages: 121
Registered: June 2013
Location: India
Senior Member
Hii..
I want to copy image/pdf/doc file from one folder to another folder. For that I use following code but its not working.

DECLARE
    v_path VARCHAR2 := 'C:\ESM\IMAGE\';
BEGIN
    HOST ('COPY '||v_path||'admin.jpg '||v_path||'BE\2013\', NO_SCREEN);
END;


I want to copy admin image from 'C:\ESM\IMAGE\' to 'C:\ESM\IMAGE\BE\2013'.
Can anybody tell me how to do this..
Re: How to copy image from one folder to another using Oracle Form 6i [message #598305 is a reply to message #598303] Sat, 12 October 2013 14:58 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Host ('Copy c:\mughal\a.doc d:\kings');

again windows 7 could be problem Smile Cool

Regard
Mughal
Re: How to copy image from one folder to another using Oracle Form 6i [message #598306 is a reply to message #598305] Sat, 12 October 2013 20:39 Go to previous messageGo to next message
dark_prince
Messages: 121
Registered: June 2013
Location: India
Senior Member
Hey thanks now its working. And this time i am doing this on XP only Smile.
Can you tell me how to check if particular folder is exist or not. For example if image folder is available then copy image into it else show error.
Re: How to copy image from one folder to another using Oracle Form 6i [message #598316 is a reply to message #598305] Sun, 13 October 2013 05:51 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
mughals_king wrote on Sun, 13 October 2013 01:28

again windows 7 could be problem


What is the problem with Win7 you are talking about?

One issue which I have observed is with the Administrator privileges. Is it what you are referring to?
Re: How to copy image from one folder to another using Oracle Form 6i [message #598327 is a reply to message #598306] Sun, 13 October 2013 09:09 Go to previous messageGo to next message
dark_prince
Messages: 121
Registered: June 2013
Location: India
Senior Member
Well Yeah, but i want to check programatically that whether the folder is available or not. I've added code below
DECLARE
    v_image_path	VARCHAR2(30);
    v_last_slash_pos    NUMBER;
    v_image_name	VARCHAR2(30);
    image_ext		VARCHAR2(3);
    v_path		VARCHAR2(50) := 'C:\EMP\';
    v_year  		VARCHAR2(4);
    v_new		VARCHAR2(100);
BEGIN
    v_image_path      := get_file_name('C:\ADMINDOCS', NULL,'JPEG Image (*.JPG,*.JPEG,*.JPE,*.JFIF)|*.JPG|', NULL);
    v_last_slash_pos  := INSTR(v_image_path, '\', -1) + 1;
    v_image_name      := SUBSTR (v_image_path, v_last_slash_position);    
    image_ext	      := SUBSTR (v_image_path, -3);

--  MESSAGE ('IMAGE PATH: '||v_image_path);
    v_year  :=  TO_CHAR(SYSDATE, 'YYYY');
    v_new   :=	v_path||v_year;
    
    HOST('MD '||v_new, NO_SCREEN);
    HOST('COPY '||v_image_path||' '||v_new, NO_SCREEN);
    HOST('REN '||v_new||'\'||v_image_name||'.'||image_ext||' '||:EMP.empno||'.'||image_ext , NO_SCREEN);

    READ_IMAGE_FILE (v_image_path, image_ext, 'EMP.emp_photo');
    insert_photo (:EMP.empno, TO_CHAR(:EMP.empno)||'.'||image_ext);

    IF NOT FORM_SUCCESS THEN
	RAISE FORM_TRIGGER_FAILURE;
    END IF;
END;


I've already created one folder in C drive i.e. EMP. Now under that I want to create folder based on the current year i.e. 2013. And I want to check whether
the 2013 named folder is created or not if it is created then copy the image into that folder else create the folder and then copy into it. And finally i want to
rename that image to employee's no. If image name is admin.jpg then copying it should be like 7699.jpg or either.
Can you please help me with these.
Re: How to copy image from one folder to another using Oracle Form 6i [message #598329 is a reply to message #598327] Sun, 13 October 2013 16:45 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
where you stucked Frnd Try this Smile

declare
  v_directory  varchar2(200) := 'c:\EMP\';
  a	     	 		varchar2(50);
begin 

select TO_CHAR(sysdate,'YYYY')
      	into a
	from dual;
        v_directory:='mkdir c:\EMP\'||a;
	
	host(v_directory,NO_SCREEN);
	HOST('COPY D:\admin.jpg'||v_directory, NO_SCREEN);

if form_success then
     	message('Folder Created for Current Year into Emp Folder & File Copied ');
     	message('Folder Created for Current Year into Emp Folder & File Copied ');
	    
else
    message('there are errors ');
end if; 
end;


Dear it will create Automatically one folder for current year into your EMP folder which is resides of-course in c:\EMP and will copy your desire file like admin.jpg into your target folder.

feel free for ask any question

Regard
mughal



[Updated on: Sun, 13 October 2013 16:48]

Report message to a moderator

Re: How to copy image from one folder to another using Oracle Form 6i [message #598330 is a reply to message #598329] Sun, 13 October 2013 17:16 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
if you are trying to open dialog box thn try this

:CONTROL.file_path := get_file_name('C:\ADMINDOCS', NULL, 
    'JPEG Image (*.JPG,*.JPEG,*.JPE,*.JFIF)|*.JPG|Bitmap Image (*.bmp)|*.bmp|GIF Image (*.GIF)|*.GIF|TIFF Files (*.tif)|*.tif|All Files (*.*)|*.*|', NULL);

DECLARE
	image_path VARCHAR2(200);
	image_extension VARCHAR2(3);
BEGIN
	image_path := :CONTROL.file_path;
	image_extension := SUBSTR(:CONTROL.file_path, -3);
	READ_IMAGE_FILE(:CONTROL.file_path, image_extension, 'EMP.emp_photo');

END;


Actually frnd still i don't understand your whole scenario take read image example .FMB file if you wanna save img into database thn you have to create table like Example

create table test(img long raw);


Regard
mughal

[Updated on: Sun, 13 October 2013 17:40]

Report message to a moderator

Re: How to copy image from one folder to another using Oracle Form 6i [message #598339 is a reply to message #598330] Mon, 14 October 2013 01:54 Go to previous messageGo to next message
dark_prince
Messages: 121
Registered: June 2013
Location: India
Senior Member
My friend let me explain, I've created a directory in backend i.e.
CREATE OR REPLACE DIRECTORY photo_folder AS 'C:\EMP\';


Under this folder all my images will get saved.
I am using dialog box to select image from any folder from any drive. Lets say 'E:\Images\admin.jpg'.
A folder will be created based on the current year like 2013. If 2013 folder created successfully then
this image will get copied to 'C:\EMP\2013' if not then folder will get created and then copy. After copying
that image it will get renamed to employees no. And finally it get stored into table.
And this coding I've posted earlier.

Now my only problem is that its working correctly like
1. sometimes image get copied to folder and also get renamed but not get saved into database
2. Sometimes image get copied to folder but not get renamed neither get saved into database
3. Sometimes image get copied to folder and get renamed and also get saved into database.
4. sometimes images doesn't get copied to the folder
5. if length of image name is greater than 8 then it neither get copied nor renamed.

I don't know why this is happening. I've uploaded script and form.
Can you please tell me where this is getting wrong.

Re: How to copy image from one folder to another using Oracle Form 6i [message #598340 is a reply to message #598330] Mon, 14 October 2013 01:55 Go to previous messageGo to next message
dark_prince
Messages: 121
Registered: June 2013
Location: India
Senior Member
And here is the form..Please help me with this one
Re: How to copy image from one folder to another using Oracle Form 6i [message #598357 is a reply to message #598340] Mon, 14 October 2013 05:04 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
dear everything looks fine but your rename file is little bothering may be iam not sure
this example. and wait sometime may be someother will answer in this forum.
   
   host('cmd /c rename "'||OLDNAME||'" " '||NEWNAME||' " '); 



Regard
Mughal

[Updated on: Mon, 14 October 2013 05:11]

Report message to a moderator

Re: How to copy image from one folder to another using Oracle Form 6i [message #598359 is a reply to message #598357] Mon, 14 October 2013 05:22 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Dear let me check this .fmb file in detail give me sometime actually as you know we have EID-UL-ADHA on Wednesday that i dont have that much time little busy Smile hope i will solve your problem untill unless wait let the other forum-member answer


Regard
Mughal

[Updated on: Mon, 14 October 2013 05:23]

Report message to a moderator

Re: How to copy image from one folder to another using Oracle Form 6i [message #598373 is a reply to message #598359] Mon, 14 October 2013 07:07 Go to previous messageGo to next message
dark_prince
Messages: 121
Registered: June 2013
Location: India
Senior Member
Oh ya sure. I'm also trying to solve problem. The main problem is length of image if its above 8 then it doesn't get copied.
Re: How to copy image from one folder to another using Oracle Form 6i [message #598403 is a reply to message #598373] Mon, 14 October 2013 09:57 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:239814548726 ---link will help you for image size

https://forums.oracle.com/thread/2165613?start=0&tstart=0

http://datadisk.co.uk/html_docs/oracle/tablespaces.htm

Alter Table 's Tablespace

A LOB (CLOB or BLOB) can be stored in a different tablespace than the rest of the table. Are you certain that you're looking at the tablespace for the table segment rather than the LOB segment?

If you want to move the LOB segment to a different tablespace

ALTER TABLE <<table name>>
MOVE LOB( <<name of BLOB column>> )
STORE AS( TABLESPACE <<new tablespace>> )


ALTER TABLE USERS MOVE TABLESPACE IMAGES

ALTER INDEX USERS REBUILD TABLESPACE IMAGES

Regard
Mughal

[Updated on: Mon, 14 October 2013 10:09]

Report message to a moderator

Re: How to copy image from one folder to another using Oracle Form 6i [message #598406 is a reply to message #598403] Mon, 14 October 2013 10:13 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member

http://www.orafaq.com/forum/m/567559/?srch=image+display+6i#msg_567559
Re: How to copy image from one folder to another using Oracle Form 6i [message #598407 is a reply to message #598406] Mon, 14 October 2013 10:23 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
http://www.orafaq.com/forum/t/144122/2/


hope you will get something from it and by by till after EID Smile Cool
Re: How to copy image from one folder to another using Oracle Form 6i [message #598431 is a reply to message #598407] Mon, 14 October 2013 11:43 Go to previous messageGo to next message
dark_prince
Messages: 121
Registered: June 2013
Location: India
Senior Member
Yeah maybe with this my problem will be solved and thanks for your help Smile
icon14.gif  Re: How to copy image from one folder to another using Oracle Form 6i [message #598500 is a reply to message #598303] Tue, 15 October 2013 06:45 Go to previous messageGo to next message
dark_prince
Messages: 121
Registered: June 2013
Location: India
Senior Member
Hii I solved the problem. The reason behind coding was not working correctly is because

    HOST('MD '||v_new, NO_SCREEN);
    HOST('COPY '||v_image_path||' '||v_new, NO_SCREEN);
    HOST('REN '||v_new||'\'||v_image_name||'.'||image_ext||' '||:EMP.empno||'.'||image_ext , NO_SCREEN


this three host command were running Simultaneously. So now I put this three command in separate button. Therefore this is running successfully. Now image get copied from one folder to another folder and then get renamed to employees no and also get saved to table.
Thank you mughals_king for helping me in these.
Re: How to copy image from one folder to another using Oracle Form 6i [message #616299 is a reply to message #598500] Sun, 15 June 2014 07:41 Go to previous messageGo to next message
EHABN2004
Messages: 9
Registered: September 2010
Location: egypt
Junior Member

dear dark price
can you send the correct fmb is solved pls.
thanks and best regards
Re: How to copy image from one folder to another using Oracle Form 6i [message #673845 is a reply to message #598373] Wed, 12 December 2018 05:50 Go to previous messageGo to next message
nanaspecialist
Messages: 3
Registered: December 2018
Junior Member
Is renaming to more than 8 characters already resolved? Can you post the right code? I know it's been more than a decade but we still using 6i so no choice. I use this code -> HOST('COPY '||v_source||' '||v_target,NO_SCREEN);

..but 1st 8 characters of the image name was only saved to the target folder, please advice'
Re: How to copy image from one folder to another using Oracle Form 6i [message #673850 is a reply to message #673845] Wed, 12 December 2018 08:09 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

http://www.orafaq.com/forum/mv/msg/153500/673846/#msg_673846

Re: How to copy image from one folder to another using Oracle Form 6i [message #673854 is a reply to message #673850] Thu, 13 December 2018 01:11 Go to previous message
nanaspecialist
Messages: 3
Registered: December 2018
Junior Member
I just said 'xcopy' is not working and my forms builder is hanging when I tried 'xcopy' instead of 'copy', my Windows version is 2003 anyways and I use Oracle 6i. Is there another way to rename it to more than 8 characters aside from this xcopy?







Previous Topic: host procedure on 6i
Next Topic: How to make search if i enter name it automatically search in the list like google
Goto Forum:
  


Current Time: Sun Dec 22 01:22:37 CST 2024