You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement a file uploader with Echo. The example in the official documentation looks great, but then I want to restrict the file type that can be uploaded.
With the regular net/http package, there's this way to get the MIME filetype of it:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello!
I'm trying to implement a file uploader with Echo. The example in the official documentation looks great, but then I want to restrict the file type that can be uploaded.
With the regular
net/http
package, there's this way to get the MIME filetype of it:However, when working with
echo.Context
, it has thec.FileHeader()
method, which only returns a*multipart.FileHeader
.EDIT
Holy, I must had been out of my mind when I started this thread. with
*multipart.FileHeader.Open()
I already got themultipart.File
that I need.Is there a good way to check the file type using only
echo.Context
?Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions