How to use uploadAssets

Can someone please provide me with some pseudocode (php if possible but anything will do) to use uploadAssets (either the internal function or the api). I can’t upload from a url and I’m having to resort to using a CDN. Or maybe, do I need to download the files or have them all coming from a particular folder. Seems archaic so I’m probably missing something.

Also when i try to upload an asset from the dashboard, I see no information about the image and it says invalid date. I can then, afterward, try to insert the image info manually. Hence my preference for being able to do all this programmatically. Thanks for your help in advance.

See attached image:

  • Ife

After uploading an image via ui you should see a thumbnail. If the upload fails, there should be a popup with an error message at the top of the page. So something is wrong… Does your webserver has write access for /storage/uploads and /storage/thumbs?

Hi. So. Having the same effect on both production and development server. Both have write access for web server. Files are actually written as I can see them in the storage uploads folder but no dice on the error messages or thumbnail. I’ll double check but no info on chrome inspector as well.

here’s the json response on random file upload
response after upload

But this is not my primary concern. I am more concerned with programmatic file uploads.
Thanks much

Ife

OK. I’m still not 100% sure, what’s going on. First: I’m not experienced with CDN and I normally use only images, so I didn’t test my approaches with pdf and other files, yet. You might have to adjust a few things.

I wrote a cli command to import a complete folder structure recently. Maybe it helps to get started.

discussion and some notes for the tool above: Upload asset folder structure - #3 by raffaelj