Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to manually store a blob image via the interface from the Upload Image field on page fron on oracle apex

Malek Al-Edresi43 hours ago

My problem is that I want to store an image of this type in mauaul format, where it only performs an update command.

....................
    P_LOGO_URL          => :P132_LOGO_URL,
    P_LOGO              => TO_BLOB(UTL_ENCODE.BASE64_DECODE(:P132_LOGO)),
    P_MIMETYPE          => :P132_LOGO_MIMETYPE,
    P_FILENAME          => :P132_LOGO_FILENAME,
    P_ADDRESS_AR        => :P132_ADDRESS_AR,
    P_ADDRESS_EN        => :P132_ADDRESS_EN,
    P_CITY_ID           => TO_NUMBER(:P132_CITY_ID)
);

This is an envelope containing only a simple message: Update.

PROCEDURE Insert_table_basic_sec_l_organization_info( 
	.......................
P_LOGO IN BASIC_SEC_L_ORGANIZATION_INFO.LOGO%TYPE, 
P_MIMETYPE IN BASIC_SEC_L_ORGANIZATION_INFO.MIMETYPE%TYPE, 
P_FILENAME IN BASIC_SEC_L_ORGANIZATION_INFO.FILENAME%TYPE, 
................... 
) IS 
BEGIN 
-- Perform the update on the specific record (ID = 2) 
	UPDATE BASIC_SEC_L_ORGANIZATION_INFO 
	SET 
........
	LOGO = P_LOGO, 
	MIMETYPE = P_MIMETYPE, 
	FILENAME = P_FILENAME, 
	IMAGE_LAST_UPDATE = SYSDATE, 
...........
	WHERE ID = 2; 

And this is the code to fetch the image from the database.

BEGIN
    -- Try to get specific record, if not found get first record
    SELECT 
  .............
        DBMS_LOB.GETLENGTH(LOGO) AS LOGO,
        MIMETYPE,
        FILENAME 
    INTO 
   ................
        :P132_LOGO,
        :P132_LOGO_MIMETYPE,
        :P132_LOGO_FILENAME
    FROM "BASIC_SEC_L_ORGANIZATION_INFO" a
    WHERE a.ID = :P132_ID
    OR (:P132_ID IS NULL AND ROWNUM = 1)
    OR NOT EXISTS (SELECT 1 FROM "BASIC_SEC_L_ORGANIZATION_INFO" WHERE ID = :P132_ID);
    
EXCEPTION
    WHEN NO_DATA_FOUND THEN
        NULL;
END;

All you need to do is store the image correctly and automatically return it to the field.

Comments
Post Details
Added 43 hours ago
0 comments
39 views