Indeed, it is probably a permission issue then.
Here is another version, it creates a temporary file with a random uuid name in the directory from which your have started streamlit. When the connection object is created, it removes the temporary file.
import streamlit as st
import sqlite3
import pathlib
import uuid
conn = None
db = st.file_uploader("Upload a SQLite database file.", type="db")
if db:
fp = pathlib.Path(str(uuid.uuid4()))
# fp = pathlib.Path("/path/to/your/tmpfile")
try:
fp.write_bytes(db.getvalue())
conn = sqlite3.connect(str(fp))
finally:
if fp.is_file():
fp.unlink()
if conn:
st.write("Connection object:", conn)