What is your problem ? A description of the problem, not the solution you are proposing.
I can upload files and save them to the db using the sqlpage.read_file_as_data_uri.
If I save the file name also using sqlpage.uploaded_file_name, then I can then download the file with correct name and extensionz
Also, no way to specify the file name (it's not in the data uri, and browser may not support that anyway.
Describe the solution you'd like
By adding support for the download="suggested-file-name.ext" parameter on HTML anchor tag <a> used in the button component, then the file will be downloaded instead of displayed when the button is clicked and browser can prompt user with suggested file name too.
Describe alternatives you've considered
I use an external service to download the file instead. This is how I want it regardless, for streaming download and to avoid including the data in the page before the user clicks "Download".
But other users may want a sqlpage contained solution.
What are you building with SQLPage ?
A tool for sharing files small files.
What is your problem ? A description of the problem, not the solution you are proposing.
I can upload files and save them to the db using the
sqlpage.read_file_as_data_uri
. If I save the file name also usingsqlpage.uploaded_file_name
, then I can then download the file with correct name and extensionzHowever, as per current documentation on file download, it is not possible to direct the browser to download the data uri rather than render it: https://sql.ophir.dev/functions.sql?function=uploaded_file_name#function
Also, no way to specify the file name (it's not in the data uri, and browser may not support that anyway.
Describe the solution you'd like
By adding support for the
download="suggested-file-name.ext"
parameter on HTML anchor tag<a>
used in the button component, then the file will be downloaded instead of displayed when the button is clicked and browser can prompt user with suggested file name too.Describe alternatives you've considered
I use an external service to download the file instead. This is how I want it regardless, for streaming download and to avoid including the data in the page before the user clicks "Download". But other users may want a sqlpage contained solution.