Dani3lSun / apex-plugin-dropzone

Oracle APEX Region Plugin - Dropzone
MIT License
72 stars 19 forks source link

External Storage #5

Closed Fatehcis closed 8 years ago

Fatehcis commented 8 years ago

Hello, Your contributions are highly appreciated.

Are you planning to support external storage e..g, the files are uploaded to Amazon or Oracle Cloud Storage, then the files link are stored in the DB.

Dani3lSun commented 8 years ago

Hi @Fatehcis

you can do this already now. The files are uploaded to a temp apex_collection, from there you can pick the files and upload it to your favorite cloud location, either via web service or a locally mounted cloud storage on your database server... I do similar thing with the open xchange webdav rest api at work, a code sample for example could look like this: New Dynamic Action:

DECLARE
  --
  CURSOR l_cur_dz_files IS
    SELECT n001    AS file_id,
           c001    AS filename,
           c002    AS mime_type,
           d001    AS date_created,
           blob001 AS file_content
      FROM apex_collections
     WHERE collection_name = 'DROPZONE_UPLOAD';
BEGIN
  --
  -- loop over dropzone files and upload with plsql procedure to other location
  FOR l_rec_dz_files IN l_cur_dz_files LOOP
    your_api.your_upload_prc(i_filename     => l_rec_dz_files.filename,
                             i_mimetype     => l_rec_dz_files.mime_type,
                             i_file_content => l_rec_dz_files.file_content);
  END LOOP;
  -- delete collection after upload
  apex_collection.delete_collection(p_collection_name => 'DROPZONE_UPLOAD');
END;

Hope this helps!

Edit: The file workflow is than like that: Client Browser --> Oracle Database --> Any cloud storage service