I’m working on a project and the user uploads their images (path is saved in MySQL) and the image itself is saved in a directory named uploads. I have my HTML CSS and JavaScript files stored in /var/www/html
and my Node.js file in /var/www/example/server.js
and my uploads directory in /var/www/example/uploads
. I’ve been troubleshooting for hours and even asked chatgpt and I can’t figure out what this issue is. I’ve tried changing the path, chmod 755, adding stuff to the Apache config and the .htaccess, and probably more. I verified that these images exist and that they load properly when adding them to a straight up HTML page. I have no idea what I’m doing wrong. The node server file and the uploads directory are both stored in the same directory. But I still keep getting this error in console:
GET https://example.com/uploads/images[]-1719563588934-59855315.jpg 404 (Not Found)
This is the path it shows me in the inspect element HTML:
<img src="/uploads/images[]-1719563589026-954829461.png" alt="Item Image" style="width:100px;height:100px;">
I’ve been troubleshooting for hours and even asked chatgpt and I can’t figure out what this issue is. I’ve tried changing the path, chmod 755, adding stuff to the Apache config and the .htaccess, and probably more. I verified that these images exist and that they load properly when adding them to a straight up HTML page. I have no idea what I’m doing wrong. The node server file and the uploads directory are both stored in the same directory.