Uploading image/file to assets through code?


How can I upload an image/file to the assets or just to the normal directory (doesn’t matter) through the code and obviously when I do that to be able to retrieve the url or path to this file all from inside the code?


If you look through all kinds of code within the editor you’ll probably find the endpoint the API uses, and you’ll most likely be able to replicate the method.


Exercise 13 in our Node tutorial has some sample code for uploading a file to the local filesystem from a form and displaying it, and the readme explains how it works: https://glitch.com/edit/#!/mountain-belly (https://glitch.com/~node-beginner)