Search This Blog

Wednesday, February 7, 2018

Image Size Restriction Validation in Oracle Apex 5.1

You want to make a restriction that user can not upload less then 20KB size image or more then 200KB  size image.
Then you can use this validation code.



declare
 cursor c is 
 select doc_size
 from apex_application_files
 where name = :P87_SGNCRD; 
 v_size number := 0;
 v_msg varchar2(100);
begin

open c; 
fetch c into v_size; 
close c;
  
if (v_size < 20480) then 
  v_msg  := 'Image must be at least 20KB!';
  DELETE from APEX_APPLICATION_FILES WHERE name = :P87_SGNCRD;  
  return v_msg;
elsif (v_size > 204800) then 
  v_msg  := 'Image size cannot be more than 200kb!';
  DELETE from APEX_APPLICATION_FILES WHERE name = :P87_SGNCRD;

  return v_msg;
end if;

end;

No comments:

Post a Comment

Split A String By Coma (,)

Step 1.  create or replace type split_tbl as table of varchar2(32767); Step 2. create or replace function split (     p_list varchar2,...