Omeka API - File upload - 403 -Invalid request. Exactly one file must be uploaded per request


I’m trying to upload an image file through the API but i get a {“message”:“Invalid request. Exactly one file must be uploaded per request.”} or a 403 error.

From RESTClient i get a { “message”: “Invalid request. Exactly one file must be uploaded per request.”}

from the app that i try to build fiddler shows me a 403 Forbidden
You don’t have permission to access /api/files on this server.


Content-Type: multipart/form-data; boundary=E19zNvXGzXaLvS5C
Content-Length: 263173
Expect: 100-continue

Content-Disposition: form-data; name=“data”
{“item”: {“id”: 76}}
Content-Disposition: form-data; name=“file”; filename="fullscreen11.jpg"
Content-Type: image/jpeg
Content-Encoding: base64


Your multipart message doesn’t look quite right… If the boundary is declared as “E19…” then the actual boundaries in the message should look like --E19.., with two leading hyphens. You do often see extra hyphens, but any beyond two would have to be included in the declared boundary in the Content-Type.

It looks like you’re working off the example from the API docs as a template. That’s really just there for illustrative purposes. Whatever you’re using to make the request should be able to put together a multipart POST for you, so you don’t have to fool around with the boundaries and encoding of each part.

Seems that were some format errors at the POST body, except the missing – at the end of the final boundary and a missing newline in the middle.

Now the POST returns 201 but the image is not uploaded correct.

So i would like to ask if the image has to been converted in base64 or in binary or something else?

Thank you.

I don’t believe you can really use Content-Transfer-Encoding in an HTTP upload, it’s really more of an email header.

A standard multipart/form-data upload will just include the as-is binary of the file directly in its part, not a base64-encoded variant.