How to copy image from one folder to another using Oracle Form 6i [message #598303] |
Sat, 12 October 2013 12:39 |
|
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 #598327 is a reply to message #598306] |
Sun, 13 October 2013 09:09 |
|
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 |
|
mughals_king
Messages: 392 Registered: January 2012 Location: pakistan
|
Senior Member |
|
|
where you stucked Frnd Try this
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 |
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|