Checking for File Type in Server Action on Production
Unanswered
Capo posted this in #help-forum
CapoOP
I'm curious because if I check for a file (image) in the code below
I get an error, which I'm assuming is because the server doesn't have access to user local files on production?
How are you effectively checking if data is an image (on the backend) when submitting form data through an action?
if (step?.image instanceof File) I get an error, which I'm assuming is because the server doesn't have access to user local files on production?
How are you effectively checking if data is an image (on the backend) when submitting form data through an action?
1 Reply
Long-legged ant
in react we have something called a filereader but idk if ur using react in the first assuming ur using react. u dont really need to check the data is an image in backend u can just do that in the client script where u will be taking the data from the user and then only send the data to ur database if its an image
well if u need something else u can ping me i can try to help u more with this
https://developer.mozilla.org/en-US/docs/Web/API/FileReader/FileReader
well if u need something else u can ping me i can try to help u more with this
https://developer.mozilla.org/en-US/docs/Web/API/FileReader/FileReader