In this Oracle APEX Tutorial, We will explore about the Download Static/Workspace Application Files in Oracle APEX.
If you want to Download the static application files or workspace application files then apex_application_static_files view and apex_workspace_static_files view will help. In this Section, I am using apex_application_static_files view to get the file.
Step 1:- Upload any file in Static Application Files and copy the reference name or file name any. The Following screenshot will help.
Step 2:- Create a download button then copy the below PL/SQL process then use this code to the button PL/SQL code section. The Following screenshot will help.
declare l_file_blob blob; l_file_name APEX_APPLICATION_STATIC_FILES.FILE_NAME%type; l_file_mimetype APEX_APPLICATION_STATIC_FILES.MIME_TYPE%type; begin select FILE_CONTENT, MIME_TYPE, FILE_NAME into l_file_blob, l_file_mimetype, l_file_name from APEX_APPLICATION_STATIC_FILES where application_id = '81446' and UPPER(FILE_NAME) = upper('app-icon.css') AND ROWNUM = 1; sys.owa_util.mime_header(l_file_mimetype, false); sys.htp.p('Content-Disposition: attachment; filename="' || l_file_name || '"'); sys.htp.p('Content-length: ' || sys.dbms_lob.getlength(l_file_blob)); sys.owa_util.http_header_close; sys.wpg_docload.download_file(l_file_blob);-- Stop page processing apex_application.stop_apex_engine; end;
Step 3:- Change the page properties, Go to the page advanced section and find reload on submit section. Now change that section with the only for success. The Following screenshot will help.
Now you can see that user are able to download the static application files. For same you can also download the workspace files just changing the view name on the existing code.
That's all for today, I think(Download Static/Workspace Application Files in Oracle APEX) post will helpful for you. If you like the post then share your view in the comment box.
3 Comments
Hi
ReplyDeleteIt is much easier. Just create a button. Set Action to "Redirect URL" and set Target to your Static File Reference "#APP_IMAGES#sample.xlsm". That's it.
Happy Apex
Thank you so much. I was struggling with this and seen your comment and it was very easy and we were writing full code for that.
DeleteTEst
ReplyDeleteIf you have any doubts, Please let me know