Dani3lSun / apex-plugin-dropzone

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

New functionality for page item #19

Closed rvnobre closed 7 years ago

rvnobre commented 7 years ago

Lets suppose i used the plugin to send photos from an meeting event. I wan to send the photos (form mobile or desktop) but before dragging i want to set a page items to write event code, event date, participants and the drag the photos, so my table will get the page items and upload columns accordingly and then your plugin add std columns mimetype,blob,filename etc.

Dani3lSun commented 7 years ago

I don´t know if I got you correct, but you want to save the files + additional data from input items?

If so, you can use the "Dropzone Upload Complete" Event to execute custom PL/SQL Code after the files were uploaded to the temp. APEX Collection or a simple Page Process...

DECLARE
  CURSOR l_cur_files IS
    SELECT c001    AS filename,
           c002    AS mime_type,
           d001    AS date_created,
           n001    AS file_id,
           blob001 AS file_content
      FROM apex_collections
     WHERE collection_name = 'DROPZONE_UPLOAD';
BEGIN
  -- loop over files and insert into custom event table
  FOR l_rec_files IN l_cur_files LOOP
    INSERT INTO my_event_table
      (event_id,
       event_name,
       event_date,
       file_content,
       file_name,
       mime_type)
    VALUES
      (seq_pk.nextval,
       :p1_event_name, -- item
       to_date(:p1_event_date, -- item
               'DD.MM.YYYY'),
       l_rec_files.file_content,
       l_rec_files.filename,
       l_rec_files.mime_type);
  END LOOP;
  -- after insert delete APEX collection
  IF apex_collection.collection_exists(p_collection_name => 'DROPZONE_UPLOAD') THEN
    apex_collection.delete_collection(p_collection_name => 'DROPZONE_UPLOAD');
  END IF;
END;

Is that what you want to do?

rvnobre commented 7 years ago

Awesome! I used table the first time, didn't realize the use of collection, combining it with Event. Btw, how to call the "Dropzone Upload Complete" Event ?

Dani3lSun commented 7 years ago

Hey @rvnobre

the Event is automatically triggered by the Plugin if all files are uploaded to the server. You can see a example in the demo app: https://github.com/Dani3lSun/apex-plugin-dropzone/releases/tag/v2.0.2 or use a Dynamic Action like this: preview

rvnobre commented 7 years ago

Dani, worked like a charm!