Easier way of uploading?

Hi
Is there an easier way of uploading files that aren’t .js or such.
Because when uploading media, you have to go through and download the widgets and then rename them to what you want.
This can be difficult when you need to upload 5 images.
Is there an easier way?

1 Like

Hey @SpeedyCraftah there isn’t a built-in method for saving media files stored in the assets drawer to your project aside from using something like wget to download each image one at a time, which I imagine is what you’re already doing. We have some work planned for the future for improvements to how assets are handled, but I don’t have any specific timeline for when we might get to that work (although, as always, opening or voting for a topic in https://support.glitch.com/c/feature-ideas is a great way to help us understand what the most requested features are).

There is a small workaround that you might be able to use to ease things a little bit for you. Once the assets drawer has been displayed, you can access the list of assets in your browser’s console, and you might be able to use that to compile a list of urls to download. To get the list of urls you could do something like:

  1. open the assets drawer in your project’s editor (this loads the assets property in the editor’s javascript object)
  2. open your browser’s developer tools or javascript console (this mechanism will change based on the browser you’re using; the directions for Chrome are here).
  3. in the browser console use something like application.assets().map(function( el ) { return el.url; }); to get a list of asset / media file urls

Once you’ve got that list you can get just the ones you care to download and then follow steps like these in your project’s console to get the files locally:

  1. mkdir tmp
  2. wget -P tmp https://url-to-file-one https://url-to-file-two … (add more files as necessary)

That will download the files you list to the tmp directory.

Hope this helps!

2 Likes