8.5.8 Temporary Files

Both the APEX File Upload and Image Upload page items provide a Storage Type setting of Table APEX_APPLICATION_TEMP_FILES. Both support uploading either single or multiple files.

When you configure their Purge File at setting to End of Session, then the uploaded files remain queryable in the APEX_APPLICATION_TEMP_FILES table for the duration of the session. Only files pertaining to the current session appear in the table.

The value of the NAME column uniquely identifies each temporary file. This is different from the FILENAME column in the table that reflects the actual name of the file. For a File Upload or Image Upload item that supports a single file, you can query the uploaded filename, MIME type, and binary contents with a query like:
select blob_content,
       mime_type,
       filename
  from apex_application_temp_files
where name = :P1_SINGLE_FILE_UPLOAD
In contrast, if the page item allows multiple files, then its value will be a colon-separated list of unique uploaded file names. So the query needs to handle that list like this:
select blob_content,
       mime_type,
       filename
  from apex_application_temp_files
where name in (select column_value
                 from apex_string.split('P1_MULTI_FILE_UPLOAD',':'))
You can proactively clear the table using a regular SQL statement like:
DELETE FROM APEX_APPLICATION_TEMP_FILES

To only remove selected temporary files, just add an appropriate where clause.