summaryrefslogtreecommitdiffstats
path: root/webapp/actions/file_actions.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/actions/file_actions.jsx')
-rw-r--r--webapp/actions/file_actions.jsx26
1 files changed, 26 insertions, 0 deletions
diff --git a/webapp/actions/file_actions.jsx b/webapp/actions/file_actions.jsx
new file mode 100644
index 000000000..0399a2c28
--- /dev/null
+++ b/webapp/actions/file_actions.jsx
@@ -0,0 +1,26 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as AsyncClient from 'utils/async_client.jsx';
+import Client from 'client/web_client.jsx';
+
+export function uploadFile(file, name, channelId, clientId, success, error) {
+ Client.uploadFile(
+ file,
+ name,
+ channelId,
+ clientId,
+ (data) => {
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ AsyncClient.dispatchError(err, 'uploadFile');
+
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}