Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
[MM-27277] Enable stream mode for file uploads (#6568)
Browse files Browse the repository at this point in the history
* Enable stream mode for file uploads

* Add comment
  • Loading branch information
streamer45 authored Sep 29, 2020
1 parent b679d63 commit 7153d43
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion actions/file_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ export function uploadFile(file, name, channelId, rootId, clientId) {
return request.
post(Client4.getFilesRoute()).
set(Client4.getOptions({method: 'post'}).headers).
attach('files', file, name).

// The order here is important:
// keeping the channel_id/client_ids fields before the files contents
// allows the server to stream the uploads instead of loading them in memory.
field('channel_id', channelId).
field('client_ids', clientId).
attach('files', file, name).
accept('application/json');
};
}
Expand Down

0 comments on commit 7153d43

Please sign in to comment.