# Find the path to the PDF file.
path = system.file.openFile("pdf")
# Check to ensure that the user actually selected a filepath.
if path != None:
# Read the file as bytes.
data = system.file.readFileAsBytes(path)
# Ask the user to enter in a filename.
# Will grab just the filename and extension from the path as a suggestion.
name = system.gui.inputBox("Enter a name for the file", path.split('\\')[-1])
# Check to ensure that the user entered a name for the file.
if name != None:
# Insert the data and name into the database.
system.db.runPrepUpdate("INSERT INTO files (fileName, fileBytes) VALUES (?,?)", [name,data])