Home » Developer & Programmer » Forms » Upload an image (Oracle Forms : 12c (12.2.1.4.0);Fusion Middleware: fmw_12.2.1.4.0 and O/S: Windows 10 pro 64 bit)
Upload an image [message #679825] Thu, 02 April 2020 14:06 Go to next message
buggleboy007
Messages: 249
Registered: November 2010
Location: Canada
Senior Member
Hello all,

I am trying to select an image when I press 'UPLOAD' button and unable to accomplish it. Hope one of you can assist me in this:

I have created a button called 'upload' and in 'when-button-pressed' trigger, I have the following code:
declare
	 v_file varchar2(4000) :=client_get_file_name ('','', 'C:\*.jpg', 'Select STYLE OF THE image', open_file, TRUE);
	 it_image_id ITEM:=FIND_ITEM('IMAGES.IMAGE_FILE_SOURCE_LOCALDATA');
begin
													  
	read_image_file(v_file,'ANY','IMAGES.IMAGE_FILE_SOURCE_LOCALDATA');
	write_image_file(v_file,'ANY' 'IMAGES.IMAGE_FILE_SOURCE_LOCALDATA',maximize_compression,ORIGINAL_DEPTH);
end;
When I press the UPLOAD button, all it does is, it shows 'My Documents' folder and nothing beyond it happens.
My aim is to show the user 'C' drive and then allow him to select an image file. How can I accompolish this? I have an Image item already present on the form.
Re: Upload an image [message #679826 is a reply to message #679825] Thu, 02 April 2020 15:31 Go to previous messageGo to next message
buggleboy007
Messages: 249
Registered: November 2010
Location: Canada
Senior Member
I have tried the following too but no luck so far:

Declare
filename VARCHAR2(256);
begin
filename := GET_FILE_NAME( 'C:\|*.jpg|*.gif|');
READ_IMAGE_FILE(filename, 'ANY', 'IMAGES.IMAGE_FILE_SOURCE_LOCALDATA');
end;



Re: Upload an image [message #679827 is a reply to message #679826] Thu, 02 April 2020 15:50 Go to previous message
buggleboy007
Messages: 249
Registered: November 2010
Location: Canada
Senior Member
I solved it myself using the following code:
DECLARE
	 v_file varchar2(4000):=client_get_file_name ('','', 'C:\|*.TIFF|*.gif|', 'Select STYLE OF THE image', open_file, TRUE);
	 it_image_id ITEM:=FIND_ITEM('IMAGES.IMAGE_FILE_SOURCE_LOCALDATA');
BEGIN										  
	CLIENT_IMAGE.READ_IMAGE_FILE(v_file,'', it_image_id);
END;
The problem was that the image that I was selecting was in the form of a JPEG format and Forms does not support that besides the image format property was set to 'TIFF'. Correcting this and cropping a .TIFF image format, I was able to upload the image on the form. This fixed my issue for now.
Previous Topic: 12C forms and reports recommended book(s)
Next Topic: forms 11 g urdu language data view problem
Goto Forum:
  


Current Time: Fri May 29 09:58:35 CDT 2020