Home > Software engineering >  How Do I Upload an Object with a Prefix to Oracle Object Storage Using PLSQL
How Do I Upload an Object with a Prefix to Oracle Object Storage Using PLSQL

Time:06-06

I can upload objects using the following code. How do I upload an object where there is a prefix? Do I need to create the prefix before uploading an object, or will the prefix be created if need be?

declare
l_request_url varchar2(32767);
l_content_length number;
l_response clob;
upload_failed_exception exception;
l_request_object blob;
l_request_filename varchar2(500);
begin
select blob_content, filename into l_request_object, l_request_filename from apex_application_temp_files where name = :P2_FILE;
l_request_url := :G_BASE_URL || 'b/' || :P2_BUCKET_NAME || '/o/'  || apex_util.url_encode(l_request_filename);

l_response := apex_web_service.make_rest_request(
    p_url => l_request_url
    , p_http_method => 'PUT'
    , p_body_blob => l_request_object
    , p_credential_static_id => 'OCI API Access'
);
end;

Thanks

CodePudding user response:

For upload and delete functions, the prefix is considered to be part of the object name.

If your prefix is aabb and the object is test.png, then the the object name would aabb/test.png

The only time prefix is used is when listing objects. When you use the prefix, only objects with the same prefix are listed.

  • Related