API Request: Document Upload create only a Corrupt File within M-Files

Hello,

I am currently struggling with uploading documents to M-Files via the REST API. I am using a Laravel PHP application to create the request. From the technical side, the following works so far:
• Authentication
• Creating an UploadFile
• Creating a SingleFileDocument or MultiFileDocument

However, the file in M-Files has the correct filename and file type but is always just an empty container. The actual document content is never uploaded and the file is corrupt.

What am I missing?


UploadFileRequest

CreateSingleFileDocument

Best regards

Sebastian

Parents
  • The response of the second request is:

    {
    "Title":"m-files",
    "EscapedTitleWithID":"m-files (ID 247).pdf",
    "DisplayID":"247",
    "ObjVer":{
    "Version":3,
    "VersionType":4,
    "ID":247,
    "Type":0
    },
    "Class":207,
    "CheckedOutAtUtc":"1601-01-01T00:00:00Z",
    "CheckedOutAt":"1601-01-01T00:00:00Z",
    "LastModifiedUtc":"2024-11-22T13:21:27Z",
    "LastModified":"2024-11-22T13:21:27Z",
    "ObjectCheckedOut":false,
    "ObjectCheckedOutToThisUser":false,
    "CheckedOutTo":0,
    "SingleFile":true,
    "HasRelationshipsFrom":false,
    "HasRelationshipsTo":false,
    "HasRelationshipsFromThis":false,
    "HasRelationshipsToThis":false,
    "HasAssignments":false,
    "Deleted":false,
    "IsStub":false,
    "ThisVersionLatestToThisUser":true,
    "CreatedUtc":"2024-11-22T13:21:22Z",
    "Created":"2024-11-22T13:21:22Z",
    "Files":[
    {
    "Name":"m-files",
    "EscapedName":"m-files.pdf",
    "Extension":"pdf",
    "Size":236874,
    "LastModified":"2024-11-22T13:21:24Z",
    "ChangeTimeUtc":"2024-11-22T13:21:24Z",
    "ChangeTime":"2024-11-22T13:21:24Z",
    "CreatedUtc":"2024-11-22T13:21:22Z",
    "CreatedDisplayValue":"22.11.2024 13:21",
    "LastModifiedDisplayValue":"22.11.2024 13:21",
    "FileGUID":"{424128F4-FF05-4E00-A84E-54A8E4088F44}",
    "ID":280,
    "Version":1,
    "FileVersionType":3
    }
    ],
    "VisibleAfterOperation":true,
    "PathInIDView":"0\\0-999\\247\\S\\v3",
    "LastModifiedDisplayValue":"22.11.2024 13:21",
    "CheckedOutAtDisplayValue":"01.01.1601 00:00",
    "CreatedDisplayValue":"22.11.2024 13:21",
    "ObjectVersionFlags":2,
    "Score":0,
    "LastAccessedByMe":"2024-11-22T13:21:25Z",
    "AccessedByMeUtc":"2024-11-22T13:21:25Z",
    "AccessedByMe":"2024-11-22T13:21:25Z",
    "ObjectGUID":"{DA93DAF1-C28E-4B75-BEA8-B77A3B39DC64}",
    "ObjectCapabilityFlags":-1,
    "ObjectFlags":68,
    "propertyID":0,
    "LatestCheckedInVersion":3,
    "BaseProperties":[
    
    ]
    }

Reply
  • The response of the second request is:

    {
    "Title":"m-files",
    "EscapedTitleWithID":"m-files (ID 247).pdf",
    "DisplayID":"247",
    "ObjVer":{
    "Version":3,
    "VersionType":4,
    "ID":247,
    "Type":0
    },
    "Class":207,
    "CheckedOutAtUtc":"1601-01-01T00:00:00Z",
    "CheckedOutAt":"1601-01-01T00:00:00Z",
    "LastModifiedUtc":"2024-11-22T13:21:27Z",
    "LastModified":"2024-11-22T13:21:27Z",
    "ObjectCheckedOut":false,
    "ObjectCheckedOutToThisUser":false,
    "CheckedOutTo":0,
    "SingleFile":true,
    "HasRelationshipsFrom":false,
    "HasRelationshipsTo":false,
    "HasRelationshipsFromThis":false,
    "HasRelationshipsToThis":false,
    "HasAssignments":false,
    "Deleted":false,
    "IsStub":false,
    "ThisVersionLatestToThisUser":true,
    "CreatedUtc":"2024-11-22T13:21:22Z",
    "Created":"2024-11-22T13:21:22Z",
    "Files":[
    {
    "Name":"m-files",
    "EscapedName":"m-files.pdf",
    "Extension":"pdf",
    "Size":236874,
    "LastModified":"2024-11-22T13:21:24Z",
    "ChangeTimeUtc":"2024-11-22T13:21:24Z",
    "ChangeTime":"2024-11-22T13:21:24Z",
    "CreatedUtc":"2024-11-22T13:21:22Z",
    "CreatedDisplayValue":"22.11.2024 13:21",
    "LastModifiedDisplayValue":"22.11.2024 13:21",
    "FileGUID":"{424128F4-FF05-4E00-A84E-54A8E4088F44}",
    "ID":280,
    "Version":1,
    "FileVersionType":3
    }
    ],
    "VisibleAfterOperation":true,
    "PathInIDView":"0\\0-999\\247\\S\\v3",
    "LastModifiedDisplayValue":"22.11.2024 13:21",
    "CheckedOutAtDisplayValue":"01.01.1601 00:00",
    "CreatedDisplayValue":"22.11.2024 13:21",
    "ObjectVersionFlags":2,
    "Score":0,
    "LastAccessedByMe":"2024-11-22T13:21:25Z",
    "AccessedByMeUtc":"2024-11-22T13:21:25Z",
    "AccessedByMe":"2024-11-22T13:21:25Z",
    "ObjectGUID":"{DA93DAF1-C28E-4B75-BEA8-B77A3B39DC64}",
    "ObjectCapabilityFlags":-1,
    "ObjectFlags":68,
    "propertyID":0,
    "LatestCheckedInVersion":3,
    "BaseProperties":[
    
    ]
    }

Children