Hi All,
I am trying to store image files to the FILES directory of the Oracle ATP database version 19c running in Cloud.
I created an ORDS service endpoint with a POST handler that accepts the file_name and file_type as http_header. I attach the image data as a binary file to the request body in Postman to invoke the service.
The PLSQL code used in the POST handler is as follows:
DECLARE
l$output_file utl_file.file_type;
BEGIN
IF (:file_name IS NOT NULL AND :file_type IS NOT NULL AND :body IS NOT NULL) THEN
-- Storing file in database file system
l$output_file := utl_file.fopen('FILES', :file_name, 'w');
utl_file.put_raw(l$output_file, :body);
utl_file.fflush(l$output_file);
utl_file.fclose(l$output_file);
:status := 201; -- http status code
END IF;
END;
When I call the service, I receive 201 status code but the image stored inside the files has 0 bytes. See the entry 3 frame_001174.PNG in the screenshot below:
Any idea of how this can be fixed?
I will appreciate your response.
Many Thanks and
Kind Regards,
Bilal