PythonAnywhere Forums

Upload Files to MySQL database in Flask


I am using a Flask app to host a web portal to display data. Part of this app is the upload for files to a database (in this situation I am using the MySQL DB of pythonanywhere). My difficulty has been that some files don't get fully uploaded.

So, I am looking for help to successfully upload for example a 5Mb csv file to a table as a BLOB

Thanks in advance.

Regards, Hugo

Hi there, what happens when the files don't completely upload? Do you get an error? Or does the browser time out after a certain amount of time?

Hi Harry,

I managed to figure out the problem. I was using the BLOB type to store the file, which only stores up to 64KB. To fix it I only needed to change the type to MEDIUMBLOB or LARGEBLOB.

Thank you anyway for your reply :)

Great -- glad you worked it out!