<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/binary-file-uploads-to-rest-endpoints-using-jakarta-ee-or-quarkus-co3vnjwjs" -->

---
title: Binary file uploads to REST endpoints using Jakarta EE...
description: A practical guide to building REST endpoints that accept binary file uploads in Jakarta EE and Quarkus. Covers three approaches: the standard Jakarta REST 3.1...
canonical: https://daily.dev/posts/binary-file-uploads-to-rest-endpoints-using-jakarta-ee-or-quarkus-co3vnjwjs
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Binary file uploads to REST endpoints using Jakarta EE or Quarkus | daily.dev
og:description: A practical guide to building REST endpoints that accept binary file uploads in Jakarta EE and Quarkus. Covers three approaches: the standard Jakarta REST 3.1...
og:url: https://daily.dev/posts/binary-file-uploads-to-rest-endpoints-using-jakarta-ee-or-quarkus-co3vnjwjs
og:image: https://api.daily.dev/og/posts/co3vNjwJs.png
og:image:alt: Binary file uploads to REST endpoints using Jakarta EE or Quarkus
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Binary file uploads to REST endpoints using Jakarta EE or Quarkus

**[Jakarta EE](https://daily.dev/sources/jakartaee)** · 12 min read · 1 upvotes · 0 comments

## Summary

A practical guide to building REST endpoints that accept binary file uploads in Jakarta EE and Quarkus. Covers three approaches: the standard Jakarta REST 3.1 EntityPart API for portable multipart/form-data handling, the Quarkus-specific @RestForm with FileUpload for a more ergonomic experience, and raw application/octet-stream for single-file body uploads. Each approach includes working code examples, curl commands showing the wire format, and a pros/cons breakdown. Also covers security considerations: capping upload size, not trusting client-supplied Content-Type or filenames, streaming instead of buffering, and scanning uploaded content.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://mehmandarov.com/rest-api-binary-attachments>

## Questions this post answers

### How do I accept a multipart file upload in a portable way using Jakarta REST 3.1?

Use the EntityPart API added in Jakarta REST 3.1, part of Jakarta EE 10 and later. Declare a method parameter of type List<EntityPart>, then loop over parts checking getName(); read text parts with getContent(String.class) and binary parts as an InputStream via getContent(), streaming without buffering the whole file. This code runs unchanged on Helidon, Open Liberty, Payara, Jersey, and Quarkus.

_Developers weighing portable versus vendor-specific upload code can track Jakarta EE API changes on daily.dev._

### What is the difference between Quarkus @RestForm FileUpload and Jakarta REST EntityPart for handling file uploads?

@RestForm with FileUpload is Quarkus-specific and less boilerplate: each multipart field binds directly to a parameter, and FileUpload exposes fileName(), size(), contentType(), and uploadedFile() pointing to a temp file already streamed to disk by Quarkus. EntityPart is the vendor-neutral Jakarta REST 3.1 standard that requires a manual loop over parts but runs on any compliant runtime, not just Quarkus.

_Teams deciding between portable and framework-specific upload code can compare trade-offs like this on daily.dev._

### How should I send a raw binary file as a REST request body without multipart encoding?

Consume application/octet-stream (or a specific content type) and take the request body as an InputStream, passing metadata like filename through custom headers such as X-File-Name since there is no Content-Disposition part. When testing with curl, use --data-binary rather than -d/--data, because -d strips newlines and null bytes and silently corrupts binary payloads.

_Developers debugging corrupted binary uploads can find gotchas like this curated on daily.dev._

## Similar posts on daily.dev

- [Hashtag Jakarta EE \#341](https://daily.dev/posts/hashtag-jakarta-ee-341-ycnerpfns) · Jakarta EE · 0 upvotes · 0 comments
- [Quarkus REST with Apache Camel and Keycloak](https://daily.dev/posts/quarkus-rest-with-apache-camel-and-keycloak-aq3lwhcdu) · Piotr Minkowski TechBlog · 4 upvotes · 0 comments
- [Access Resources in a Quarkus Native Image](https://daily.dev/posts/access-resources-in-a-quarkus-native-image-m3onvzzfa) · Baeldung · 1 upvotes · 0 comments
- [Secure File Uploads with Multi-Layer Validation](https://daily.dev/posts/secure-file-uploads-with-multi-layer-validation-eujcav7tj) · Halodoc · 3 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java), [#rest-api](https://daily.dev/tags/rest-api), [#quarkus](https://daily.dev/tags/quarkus), [#jakarta-ee](https://daily.dev/tags/jakarta-ee)

[View this post on daily.dev](https://daily.dev/posts/binary-file-uploads-to-rest-endpoints-using-jakarta-ee-or-quarkus-co3vnjwjs)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Binary file uploads to REST endpoints using Jakarta EE or Quarkus","url":"https://daily.dev/posts/binary-file-uploads-to-rest-endpoints-using-jakarta-ee-or-quarkus-co3vnjwjs","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/binary-file-uploads-to-rest-endpoints-using-jakarta-ee-or-quarkus-co3vnjwjs"},"datePublished":"2026-07-08T23:34:33.830Z","dateModified":"2026-09-14T07:36:30.573Z","description":"A practical guide to building REST endpoints that accept binary file uploads in Jakarta EE and Quarkus. Covers three approaches: the standard Jakarta REST 3.1...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/61de6157be4315ae4aa4c7acb7393b76?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/61de6157be4315ae4aa4c7acb7393b76?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Jakarta EE","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Jakarta EE","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/5ef0720bb0684fa3ab12b4d4634f8028","url":"https://daily.dev/sources/jakartaee"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/binary-file-uploads-to-rest-endpoints-using-jakarta-ee-or-quarkus-co3vnjwjs","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,rest-api,quarkus,jakarta-ee","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Jakarta EE","item":"https://daily.dev/sources/jakartaee"},{"@type":"ListItem","position":3,"name":"Binary file uploads to REST endpoints using Jakarta EE or Quarkus"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/binary-file-uploads-to-rest-endpoints-using-jakarta-ee-or-quarkus-co3vnjwjs#faq","mainEntity":[{"@type":"Question","name":"How do I accept a multipart file upload in a portable way using Jakarta REST 3.1?","acceptedAnswer":{"@type":"Answer","text":"Use the EntityPart API added in Jakarta REST 3.1, part of Jakarta EE 10 and later. Declare a method parameter of type List<EntityPart>, then loop over parts checking getName(); read text parts with getContent(String.class) and binary parts as an InputStream via getContent(), streaming without buffering the whole file. This code runs unchanged on Helidon, Open Liberty, Payara, Jersey, and Quarkus. Developers weighing portable versus vendor-specific upload code can track Jakarta EE API changes on daily.dev."}},{"@type":"Question","name":"What is the difference between Quarkus @RestForm FileUpload and Jakarta REST EntityPart for handling file uploads?","acceptedAnswer":{"@type":"Answer","text":"@RestForm with FileUpload is Quarkus-specific and less boilerplate: each multipart field binds directly to a parameter, and FileUpload exposes fileName(), size(), contentType(), and uploadedFile() pointing to a temp file already streamed to disk by Quarkus. EntityPart is the vendor-neutral Jakarta REST 3.1 standard that requires a manual loop over parts but runs on any compliant runtime, not just Quarkus. Teams deciding between portable and framework-specific upload code can compare trade-offs like this on daily.dev."}},{"@type":"Question","name":"How should I send a raw binary file as a REST request body without multipart encoding?","acceptedAnswer":{"@type":"Answer","text":"Consume application/octet-stream (or a specific content type) and take the request body as an InputStream, passing metadata like filename through custom headers such as X-File-Name since there is no Content-Disposition part. When testing with curl, use --data-binary rather than -d/--data, because -d strips newlines and null bytes and silently corrupts binary payloads. Developers debugging corrupted binary uploads can find gotchas like this curated on daily.dev."}}]}
```

