JamzAppz Posted October 28, 2020 Report Share 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 Quote Link to comment Share on other sites More sharing options...
JamzAppz Posted November 1, 2020 Author Report Share 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.