Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multipart Example #33

Closed
mintu19 opened this issue Apr 5, 2020 · 1 comment
Closed

Multipart Example #33

mintu19 opened this issue Apr 5, 2020 · 1 comment

Comments

@mintu19
Copy link

mintu19 commented Apr 5, 2020

I am trying to create route to receive upload file to server but not able to find a way to implement it. I have seen multipart content provider in code but not sure how to use it.

How to write post data server code for multipart something like this:
https://ktor.io/servers/uploads.html

@Wicpar
Copy link
Collaborator

Wicpar commented Apr 6, 2020

Hi, It is natively supported by the library, example Request type definition:

@FormDataRequest
data class PDFFileCreateDTO(@PartEncoding("application/pdf") val file: NamedFileInputStream, val name: String, val public: Boolean)

// then in your route like usual

post<Params, Response, PDFFileCreateDTO> { params, payload ->
...
}

It has not been tested yet on the experimental branch, but it should work, if it doesn't please create an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants