JamzAppz Posted October 28, 2020 Report Posted October 28, 2020 I have been trying to find out how to fix an app I had built from a udemy course a while back, I am realizing that gravatar does not work. So I am trying to do a manual file upload for setting a profile pic. I felt discouraged to even ask of this here because there was not a segment on MERN via the course videos. In my actions file i have an auth.js with a register method, I was trying to take the avatar parameter and trying to use the .replace() to strip the C:\fakepath\ prepended string to the filename so that a user image will appear on the client. Has anyone ever encountered this obstacle? sc::https://github.com/jamesAppello/devverse
JamzAppz Posted November 1, 2020 Author Report Posted November 1, 2020 I just realized now that you cannot upload an image file via application/json. Instead I somehow need to convert my project to use multipart/form-data in a MERN app. But the app uses JWT, so if i use multipart/form-data for registering/logginIn would jwt not work unless i use application/json? But without json how would it be possible to complete this app so that a user auth works so that they are signed into their userProtected Routes so then also user can select their own profile pic so that it shows on profile and user posts? Everything in this app works besides the image upload. Something so mundane but I have to get this to work. Has anyone gone through this before, by any chance?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now