from io import BytesIO
file_byte_string = app_tables.quotes.get(quote_number='2-1001')['quote_pdf'].get_bytes()
with BytesIO(file_byte_string ) as f:
file_data = f.read()
file_type = imghdr.what(f.name)
file_name = str(f.name).split(chr(92))[-1]
I am not sure if the rest of your code will actually be able to get a name of a file from a byte string, if you stored your data as a media object it has information about the file like name, type etc.
Thank you, that did work to open the file. However, I failed to mention that I am then adding the file as an email attachment, and as such did not send the file as the correct file type.
I did, however, find a much better way to do what I am looking for with your reminder that I can get the data type and name from anvil. The way I got this working is as such: