Image upload via API in File-Field

Hi community,

id like to upload images to my database via API. Unfortunately, I always get an error as soon as I want to upload a new image that is not yet in my database.

Error message
The user file name is invalid

My code

$data = ‘{
}, “url”: “”,
“name”: “Do-it-simply-Just-do-it1.jpg”

Field type

What am I doing wrong?
Thanks in advance

Hi Sebastian, welcome to the Baserow community. Judging from the example code that you have provided, I think you’re trying to upload an image directly when updating/creating a row? This is unfortunately not possible. You must first upload your file, to the user files and after that it can be used in row. You might want to take a look at the documentation of these endpoints and They describe how you can upload from disk or from a URL.

The name that’s in the response of user file endpoints, is that name that you can use when you want to update the file field value of a row. A small downside is that you can only upload files via the JWT authentication at this point. That means you can’t use token that you generated via the web-frontend for this. This is going to be changed in the future.

Hi Bram,

thank you very much for the helpful answer. You already got it right, I wanted to upload the image directly (that would also make the process a bit less complicated from my point of view). Anyway, got it running through your helpful links.

I do have one question though: is there a way to view all the files already uploaded in one place?

Thanks a lot and greetings

Glad to hear that it worked for you. It’s unfortunately not possible to view all the files that you have uploaded.