Assets folder path

  1. Go to the assets folder in your project and select the image you want to upload locally to your Glitch project. Click on the ‘copy url’ button. This will copy an image url like https://cdn.glitch.com/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521 to your clipboard.

  2. Go to the console in Glitch, and if you don’t already have an assets folder, type mkdir assets and hit enter.

  3. type cd assets and hit enter to move into the assets folder

  4. type wget and then paste the image url you copied previously into the console, so you see something like wget https://cdn.glitch.com/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521 and hit enter. That’ll import that image to your assets folder. Note that it’ll be imported with the name f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521. To make it easier to deal with you’ll want to rename it. To do so, type mv /app/assets/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521 /app/assets/w6.jpg and hit enter. You can confirm the asset renamed correctly by typing ls -al and you’ll see a list of files, one of which should be called w6.jpg.

  5. Repeat steps 1 and 4 for each image you want to upload. Be sure to change the name of the file to the relevant one in step 4.

The path you’ll then use is: __dirname + '/assets/w6.jpg'

6 Likes