1
votes

I am using a page item of type "File Browse..." in Oracle Apex.

I can upload a file into a BLOB database column, and download it, which is great.

However, I am having trouble specifying the filename for the download. By default it is just called "download" without any file extension.

I understand that I can specify database columns to hold the filename and other metadata (as explained here: Use of BLOB type column in Oracle APEX). However, I would prefer to avoid having more columns in the database, because the filename will be the same for every row - it would just be lots of duplicate data.

What I would like to do is just specify a static filename for all downloads from the File Browse... page item.

Can it be done? If so, how?

1
What exactly are you trying to do? Change the filename of the file that is stored in the database? Or change the name of the download link that you later show in your APEX?Bart van der Drift
I want to change the (default) name of the file which is actually downloaded by the browser.user2003974
I wanted to do something similar in Apex 4.1, but concluded that the only way would be to do a bit of jQuery trickery after the page loads. In my case, I decided it wasn't worth the trouble.Bacs

1 Answers

1
votes

Create a view on the table your files are in. This view will expose the same rows and columns, but also adds the columns for mimetype, filename, etc. with a static string. Something like this:

CREATE VIEW downloads_v AS
SELECT d.col1
,      d.col2
,      ...
,      d.colX
,      'myfile.ext' as filename
,      'Application/Octet-Stream' as mime_type
,      'utf8' as charcater_set
from   downloads d;

Then you create your apex report on this view instead of the original table. This way you get the same functionality as adding these columns to your table, but you avoid having storage space going to waste.