Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Please ask technical questions in the appropriate category. Thank you!

Prevent Duplicate File Uploads

B_BrockApr 22 2024

I have an apex app where end users will upload text files.

I'm currently saving the files into a blob column in table data_set_files shown below. After the apex page uploads the file, I am currently calling a custom function that generates a checksum value, and stores the result into the file_checksum column of the newly created row.

My goal is to prevent duplicate file uploads. Since I have a checksum stored for previously stored blobs, how can I prevent duplicates from being uploaded? My thought is to create a validation on the upload page that will first generate the checksum of the file being uploaded (sub-question: would the checksum of the raw file be the same as the blob column?), and query the database to see if that checksum already exists. Not sure how to accomplish that.

Perhaps there is a better way to accomplish this than what I'm doing???

create table data_set_files (
id number default on null to_number(sys_guid(), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
constraint data_set_files_id_pk primary key,
file_name varchar2(4000 char),
file_mimetype varchar2(512 char),
file_charset varchar2(512 char),
file_blob blob not null,
file_comments varchar2(4000 char),
file_checksum varchar2(4000 char),
) ;

APEX 23.2.3 OCI
19C

Comments
Post Details
Added on Apr 22 2024
3 comments
106 views