When I upload per dnd for example aframe.js (besides others) a “Reconnecting” notification, creates the file eventually, but its empty. Same thing with creating a new file through the “New file” button, then trying to paste the content into the file.
Is this a size restriction for script files? aframe.js is about 2MB
Yes, that’s right - there’s a size limit of 200kb, see https://glitch.com/faq#restrictions. You could use wget and import via the console or include as a package.
Thanks for the answer.
In that case, a nice error message would be nice when this limit is hit.
Hi, I have a similar problem. Can you reccomend any newbie level tutorial on how to upload a file using wget?
I tried to upload a 5 mb .js file and then smaller .txt file under 200 kb, but I got no results. Uploaded files to github, tried different npm packages (nugget, t-get, node-wget), used wget command, got message that file was uploaded. But I cant’s see 200 kb file in my project files. Am I doing it wrong?
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.
Instead of doing step 5 to rename the files in the command editor which is quite cumbersome, i found it was simpler to issue the “refresh” command in console, which forces the files to display within the correct folder in the editor UI.
From here you can click the 3-dot menu to rename the file with a dialog. Just be sure to include the folder name in the new title to keep it in the folder you want. eg, if its in images, rename it ‘images/newfilename.meh’.