Upload script file -> reconnect

Sure - you could well be doing it right, but there are a couple of gotchas that might mean it’s there but still won’t be shown in the editor.

  • In the Glitch editor, select ‘assets’, ‘add asset’ and select the file you want to upload.

  • Once uploaded, click on the file preview and select ‘copy url’.

  • Now go to the project info menu at the top-left, and click on ‘Advanced Options’, then ‘Open Console’.

  • Assuming you want the uploaded file to be in the current directory (which by default will be the root directory), then type wget with a space and then paste the URL you copied, (you should see something like wget https://cdn.glitch.com/899ec27e-9151-4689-94a6-7da643bc90d9%2Fp5.js?1502880537840) and hit enter.

  • You’ll then see some text confirming the file upload. Your file is now on Glitch. However, it will have a funky name, like the above example will be called 899ec27e-9151-4689-94a6-7da643bc90d9%2Fp5.js?1502880537840. You can rename this file by typing mv /app/funkyFileName.js /app/nameYouWant.js e.g. mv /app/899ec27e-9151-4689-94a6-7da643bc90d9%2Fp5.js?1502880537840 /app/p5.js.

  • This will have renamed your file to what you want. You can confirm that by entering ls, which lists the files in the current directory. You should see your file listed.

  • Files uploaded via the console aren’t automatically shown in the editor, type refresh to get the editor to sync with your changes.

  • You may or may not see your file in the editor at this point - if the file is too large or a binary file, it’ll still be hidden from the editor. However, the file exists on the filesystem so it’s programmatically accessible. So you can refer to it via its relative path in your project files.

If you’re still having problems, let me know.

1 Like