Dani3lSun / apex-plugin-dropzone

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

Remove file should delete the files from the table aslo #35

Closed maahjoor closed 7 years ago

maahjoor commented 7 years ago

Expected behavior

when i click the remove button benith the file icon in the dropzone region, it is not removing from the underlying table.

Actual behavior

when i click the remove link, it should remove that particular file from the underlying table

Steps to reproduce the issue

APEX version (4.2.6 / 5.0.3)

5.1.1

Used web server / version and platform (ORDS 3.0.3 / Tomcat 7 / Apache 2.4 / Linux x64)

ORDS

Used web browser / version and platform (Chrome 48 Mac / Firefox 44 Windows)

56.0.1 image

Dani3lSun commented 7 years ago

The remove file link can only work properly if you insert the PK via trigger, so the insert can return actually an ID. If no ID is returned when uploading a file, the delete later (with the same ID) can not work properly. Do you use an Before Insert Trigger for your PK? Each plugin attribute has an help page, this is described in the help text of "storage type" attribute... But as mentioned in the other issue: I would strongly recommend you to use the APEX collection method: https://github.com/Dani3lSun/apex-plugin-dropzone#inserting-uploaded-files-into-your-own-tables

Edit: You also have to react to an file delete, so please have a look at the events sections: https://github.com/Dani3lSun/apex-plugin-dropzone#plugin-events Especially on Dropzone File Delete Success (AJAX), if hat event gets triggered you can refresh an report for example. This is also shown in the included demo app here...

maahjoor commented 7 years ago

I had just put simple queries for now to check its working or not.

My insert code is below DECLARE -- get files data from saved apex_collection 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 cursor FOR l_rec_files IN l_cur_files LOOP -- do whatever processing is required prior to the insert into your own table INSERT INTO EIU_FILES ( FILENAME, FILE_MIMETYPE, FILE_CHARSET, FILE_BLOB, CREATED, EE_SEC_PROGREES_ID) VALUES ( l_rec_files.filename, l_rec_files.mime_type, null, l_rec_files.file_content, l_rec_files.date_created, 1 ); END LOOP; -- clear original apex collection (only if exist) IF apex_collection.collection_exists(p_collection_name => 'DROPZONE_UPLOAD') THEN apex_collection.delete_collection(p_collection_name => 'DROPZONE_UPLOAD'); END IF; END;

I put a static EE_SEC_PROGRESS_ID as foreign key because I cannot access the interactive grid row to whome it should reference. Its working and inserting a row into my table, but when I try to upload another file, the apex collection report only show the currently uploaded file, not all the uploaded files. I am really stuck in it dear. Trust me, your plugin is the only solution for my problem.

Please help me.

Regards. Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: Daniel Hochleitnermailto:notifications@github.com Sent: Sunday, October 22, 2017 11:11 AM To: Dani3lSun/apex-plugin-dropzonemailto:apex-plugin-dropzone@noreply.github.com Cc: maahjoormailto:idrees.Muhammad@hotmail.com; Authormailto:author@noreply.github.com Subject: Re: [Dani3lSun/apex-plugin-dropzone] Remove file should delete the files from the table aslo (#35)

The remove file link can only work properly if you insert the PK via trigger, so the insert can return actually an ID. If no ID is returned when uploading a file, the delete later (with the same ID) can not work properly. Do you use an Before Insert Trigger for your PK? Each plugin attribute has an help page, this is described in the help text of "storage type" attribute... But as mentioned in the other issue: I would strongly recommend you to use the APEX collection method: https://github.com/Dani3lSun/apex-plugin-dropzone#inserting-uploaded-files-into-your-own-tables

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Dani3lSun/apex-plugin-dropzone/issues/35#issuecomment-338457078, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQEbgWrvELBaKCegCtNsp3ousPllPrLdks5suuqigaJpZM4QB125.

Dani3lSun commented 7 years ago

Se answer in this issue: https://github.com/Dani3lSun/apex-plugin-dropzone/issues/33