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: 280
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: 280
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 messageGo to next message
buggleboy007
Messages: 280
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.
Re: Upload an image [message #684651 is a reply to message #679827] Sat, 17 July 2021 03:17 Go to previous messageGo to next message
MS DEVELOPER
Messages: 2
Registered: July 2021
Junior Member
Dear Sir,
your code help me for uploading and displaying image but now i want to upload pdf file save and view but it's not showing in image filed but showing image . what maybe the problem please support.
Re: Upload an image [message #684652 is a reply to message #679827] Sat, 17 July 2021 03:20 Go to previous messageGo to next message
MS DEVELOPER
Messages: 2
Registered: July 2021
Junior Member
yup it's help full for image load but i want to load pdf also save , but its processing for a while bit second but showing nothing in image fieled.please support
Re: Upload an image [message #684655 is a reply to message #684652] Sat, 17 July 2021 12:24 Go to previous message
buggleboy007
Messages: 280
Registered: November 2010
Location: Canada
Senior Member
MS DEVELOPER wrote on Sat, 17 July 2021 03:20
yup it's help full for image load but i want to load pdf also save , but its processing for a while bit second but showing nothing in image fieled.please support
Glad that my code helped but no idea what the issue or root cause at your end is.
Previous Topic: call_form
Next Topic: ON-LOCK/lock_record not working after set_record_property QUERY_STATUS
Goto Forum:
  


Current Time: Wed Dec 08 20:31:46 CST 2021