I'm using the Echo Framework's static filehandler for serving uploaded files out of my upload directory.
e := echo.New()
e.Static("/uploads","uploads")
This works fine for smaller video files. I've tested it with a 20MB videofile, which works fine. Larger files, for example a 50MB testfile, do not work. The underlying TCP connection gets closed before the whole file is being served.
Does anyone know if there is a filesize limit or a timer that can be set to prevent this?
you are looking for echo.File()
. This method serves, longer files, like yours because the underlying net/http
package used in http.FileServer()
and echo.File()
are the same. You can add something like this
echo.File("route","filepath",middleware)
.
You can also use the same functionality which is associated with echo.Context
by the same name c.File()
. Here the function definition is shorter and has an example in echo webpage https://echo.labstack.com/cookbook/file-download.