Dani3lSun / apex-plugin-dropzone

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

Add "renameFile" option to the plugin #48

Closed dwarcake closed 6 years ago

dwarcake commented 6 years ago

Expected behavior

Make it possible to rename a file when uploading. In the DropzoneJS library there is an option called "renameFile". This option could be used to call a JavaScript function (or PL/SQL code via DA) so users can rename files as they want themself. DropzoneJS documentation

Already tried to add the option after line https://github.com/Dani3lSun/apex-plugin-dropzone/blob/08f83a7adcd4c61b8e6577197ba31dd03b8a7472/server/js/apexdropzone.js#L690 and it works to call my own JavaScript function. If it is possible to customize this via PL/SQL code it could be even better but no idea how to do that yet. Line added: renameFile: customRenameFile

Actual behavior

Not implemented

Steps to reproduce the issue

Our use case: When pasting an image from the clipboard (for example take a screenshot), it always defaults to the name "image.png". We would like to edit this so we can have "screenshot-1.png" or something like that.

APEX version (4.2.6 / 5.0.3)

5.1.4

Dani3lSun commented 6 years ago

Hi @dwarcake if you use the APEX collection way, you´re able to rename the files when you´re looping through them in your PL/SQL code: https://github.com/Dani3lSun/apex-plugin-dropzone#inserting-uploaded-files-into-your-own-tables I like this method more than a client side thing, the only truth is server side :)

dwarcake commented 6 years ago

@Dani3lSun We did something along those lines at the moment, I guess we'll keep it that way :)

            if lower(r.c001) = 'image.png' then
                logger.log('Add timestamp ' || to_char(sysdate,'YYYYMMDD_HH24MISS') || ' to ''pasted'' image file', l_scope, null, l_params);
                v_filnm := 'image_' || to_char(sysdate,'YYYYMMDD_HH24MISS') || '.png';
            end if;