Forums

File upload on form works in development local server but not deployed PyAny server?

When testing a form, I'm getting an:

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

The PythonAnywhere error log is stating:

2022-03-02 23:42:06,585: Exception on / [POST]
...
...
FileNotFoundError: [Errno 2] No such file or directory: 'myfile.jpg'

As the same code works with no issues in the local development server, I wondered if I might be hitting into a PythonAnywhere upload limit? Or something like that? Any suggestions of where to look next much appreciated. Thanks!

Looks like problem with relative path. Try with absolute path. You can build it out of __file__ of your code