Go/ Fiber Image Upload Not Working in Production
HI, this is an odd one and a bit unlike what I have seen from others.
My local dev environment is and has been working without a hitch at all but when I try it on a production environment is am getting a filepath error that remains unresolved.
from production logs...
ive already tried adjusting the filepath the match the absolute. it doesnt work either.
failed to upload file: open ./public/uploads/377x305xoldswitch.jpg.pagespeed.ic.tLOiHcLqd4.jpg: no such file or directory
browser error
Go Code from main function and helper function
ummm, why is this happening?
Best Answer
-
Hey there,
The error message you're seeing, "failed to upload file: open ./public/uploads/377x305xoldswitch.jpg.pagespeed.ic.tLOiHcLqd4.jpg: no such file or directory," suggests that the program or process is trying to upload a file, but it can't find the specified file in the given directory.
There are a few things that might be happening, to rule some things out can you try the following?
- Double-check the path to the file and the filename to make sure it is accurate. There might be a typo in the filename or path.
- Check the file permissions to make sure the program or process has read access to the file and write access to the directory where it's trying to upload the file.
- Ensure that the path provided is either an absolute path or a path relative to the current working directory of the program. A relative path like "./public/uploads" is relative to the current working directory, while an absolute path starts from the root directory.
0
Answers
-
Hey,
yeah i came to the same conclusion. Just circling around to this response. The file system wasnt saving correctly on the platform side and I am still working on the resolve. Thanks for the update.
0 -
Hi,
Thank you for the update.
Please keep us posted in case you have additional questions.
Regards, Wissam
0