Silverrook
Silverrook

Reputation: 51

issue with apex_application_temp_files

I have a problem, in my ORACLE APEX app, I want to have file uploading mechanism that send uploaded .zip file as parameter to some function (that function works well, I tested it by manual feeding from DB). Problem is, when I try to select uploaded file from "apex_application_temp_files" in a process it throws exception "NO DATA FOUND", but when I add report to app where I select ID and FILENAMES I see that file...any idea why this is happen? I am sorry if this is some trivial issue, but I am pretty new in APEX developing.

The process:

declare
    l_blob blob;
begin
    SELECT blob_content
      INTO l_blob
      FROM apex_application_temp_files
      WHERE NAME = :P6_FILE;
    --INSTANTLY SET :G_TEST_ID FOR REPORTS
    :G_TEST_ID := file_management.unwrap_zip(ab_zipped_blob => l_blob);
end;

Upvotes: 0

Views: 15343

Answers (1)

Tom
Tom

Reputation: 7028

You need to select on column NAME instead of FILENAME. The former is the unique identifier (looks like series_of_numbers\the_filename) and is what the file browse item will contain, while the latter is without the prefix.


Look, you'll have to provide more information from your end. I've created a really simple page to try this (apex.oracle.com).

P2_FILE is a file-browse item.

  • Storage Type: Table APEX_APPLICATION_TEMP_FILES
  • Purge File at: End of Session

I've created an on-submit process which does nothing more than list some things in the debug output.

declare
    l_blob blob;
begin 
  for r in (select * from apex_application_temp_files)
  loop
    apex_debug.message('name: %s - filename: %s', r.name, r.filename);
  end loop;

  apex_debug.message('P2_FILE: %s', :P2_FILE);

    SELECT blob_content
      INTO l_blob
      FROM apex_application_temp_files
      WHERE name = :P2_FILE;

  apex_debug.message('blob length: %s', dbms_lob.getlength(l_blob));
end;

So I run the page, enable debug, select a file and hit submit. All works. Check the debug log (accept):

name: 39044609744029199463/README (2).md - filename: README (2).md
name: 39044529927808550681/README (1).md - filename: README (1).md
name: 39044569042020557797/README.md - filename: README.md
P2_FILE: 39044609744029199463/README (2).md
blob length: 1884

So: what's different at your end? Have you done as suggested by Jeffrey and run a debug of the page? What is your "purge" set as? Are you sure the no-data-found occurs on select of the blob and not in your procedure - have you commented out your procedure call yet?

Upvotes: 2

Related Questions