Cannot send images from assets folder

I cannot access images in my project for some reason. The whole assets folder is unavailable from the server side. I am trying to send an image doing something like this:

image = __dirname + "/assets/" + location.img;

Though I get an error:

(node:17741) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, stat ‘/app/assets/maze_6_4.jpg’

Any way I can access files from the server side?

Hey @Levelleor,

The assets folder is just a virtual folder and isn’t present in the filesystem of your project. The only way to refer to images in the assets drawer is to use the link provided. If you still want to upload images to your filesystem and refer it using paths (like how you said), then this post tells you how to do it:

Or you could run wget on the URL

wget <asset URL>

1 Like

And then you could rename the file and put it in the assets folder.

Interesting, is it really that complicated to host pictures on Glitch? I wonder why. Well, thank you, I’ll strart moving stuff to my folder now, it’s gonna be a long day.

I gotta admit, it is complicated. Hopefully @glitch_support comes up with something!

I believe they use the cdn to prevent users from using up all of the memory. There should be an option to use the CDN or the project for photos.