Save Images/Photos to directory /Folder directly Easily


Link to download plugin: https://apex.world/ords/f?p=100:710:12765664390153::::P710_PLG_ID:CAM.INT.VIKAS


**********Create  PROCEDURE ********

create or replace PROCEDURE SaveFile(

     FileContent IN   BLOB

   , FolderName IN VARCHAR2

   , FileName IN VARCHAR2)

IS

    BUFFER RAW(1024);

    OFFSET PLS_INTEGER := 1;

    FileLength PLS_INTEGER;

    amount PLS_INTEGER := 1024;

    fhandle UTL_FILE.FILE_TYPE;

BEGIN

    FileLength := DBMS_LOB.GETLENGTH(FileContent);

    fhandle := UTL_FILE.FOPEN(FolderName, FileName, 'wb');         

    LOOP

        EXIT WHEN OFFSET > FileLength;

        DBMS_LOB.READ(FileContent, amount, OFFSET, BUFFER);

        UTL_FILE.PUT_RAW(fhandle, BUFFER, TRUE);

        OFFSET := OFFSET + amount;

    END LOOP;

    UTL_FILE.FCLOSE (fhandle);

EXCEPTION

    WHEN OTHERS THEN

        IF UTL_FILE.IS_OPEN(fhandle) THEN

            UTL_FILE.FCLOSE(fhandle);

        END IF;

    RAISE;

END SaveFile;


*********Create PROCESS on Page **********

DECLARE 

V_BLOB BLOB;

C_name varchar2(100);

BEGIN

SELECT blob001,c001  INTO V_BLOB,C_name

from apex_collections where collection_name ='PHOTOS';

SAVEFILE(V_BLOB,'IMAGES2',C_name);

END;

 

************ Create Interactive report with Collection to display image captured*************


Select dbms_lob.getlength(blob001) image , c001 file_name,

c002 MIME_TYPE,

seq_id,

d001 TIMESTAMP from apex_collections where collection_name ='PHOTOS'


*******************Give GRANT ON SQL PLUS*******************



CREATE  DIRECTORY SAVE_IMAGES2 AS 'D:\image_dec';


GRANT ALL ON DIRECTORY SAVE_IMAGES2 TO MAKESS;



Stay Informed:  Stay up-to-date with the latest Oracle APEX tips and updates by following my social media profiles.

 Follow on YouTube:  Dive deeper into Oracle APEX by exploring my YouTube channel for tutorials and insights: 

 YouTube Channel: YouTube


Connect on LinkedIn:  Let's connect on LinkedIn for networking opportunities, discussions, and more: 

 LinkedIn Profile: Linkedin


Comments