The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Adding a new file to an existing object (javascript)

Hi,

I succeeded to update an existing file attached to an object via the API "REST/objects/0/{checkedOutObjectVersion.ObjVer.ID}/files/{checkedOutObjectVersion.Files[0].ID}/content.aspx?_method=PUT", although that was tough. I need now to add a new file to an existing object. From the C# example at https://developer.m-files.com/APIs/REST-API/Updating-Objects/#updating-an-existing-file, I figured out that the API is "REST/objects/0/{checkedOutObjectVersion.ObjVer.ID}/{checkedOutObjectVersion.ObjVer.Version}/files/upload.aspx". However, it is not clear at all how I pass the file name and file extension through the API, mostly since I am using an application/octet-stream content type where I cannot mix JSON data and binary data.

Any help would be appreciated, as well as javascript examples.

Thank you in advance,

Gilles Gerlinger