Search code examples
muledataweavemulesoftmule4

Find the size of a multipart/form-data file in mule4


I have a HTTP Listener which will read the file in multipart/form-data format. I want to find the size of that file and check if it is less/greater than 10 MB. Please help me with this


Solution

  • You can use the following:

    %dw 2.0
    output application/java
    ---
    sizeOf(payload.parts.file.content.^raw)
    

    Where file is the key for what is being sent.