-
Notifications
You must be signed in to change notification settings - Fork 298
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
KTOR-7801 and KTOR-7802 Document streamProvider deprecation and update the file upload example #571
base: main
Are you sure you want to change the base?
Conversation
…e the file upload example
|
||
If you need to receive a file sent as a part of a multipart request, call | ||
the [.receiveMultipart()](https://api.ktor.io/ktor-server/ktor-server-core/io.ktor.server.request/receive-multipart.html) | ||
function and then loop over each part as required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to explain why looping is necessary and why a specific part cannot be queried.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you tell me where I can find more information on this process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a short explanation. Let me know if I missed something 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
I've added minor suggestions.
Please let me know if there are any questions.
You can then stream data directly from the channel to the file output, using the | ||
[`.copyTo()`](https://api.ktor.io/ktor-io/io.ktor.utils.io/copy-to.html) or | ||
[`.copyAndClose()`](https://api.ktor.io/ktor-io/io.ktor.utils.io/copy-and-close.html) | ||
methods provided by `ByteReadChannel`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we separate "method" and "function" terms?
Or do we use both interchangeably?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use them interchangeably. Is there a difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFIAK, in Kotlin we usually use them in different contexts.
I think we can return to this topic later. Feel free to merge ;)
``` | ||
|
||
```kotlin | ||
fun Application.main() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out-of-curiosity question: why code blocks throughout a file have different indentations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was not intended. I think my IDE is not detecting these inconsistencies, although I noticed the <compare>
element doesn't include empty lines for example. I'll check what's happening...
KTOR-7801 Document migrating from streamProvider to provider in multipart content
Preview Migration guide
KTOR-7802 Add documentation and sample on how to save multipart form data in a file
Preview Multipart form data