mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(load) put: rm prefix, apiURL
This commit is contained in:
parent
995860b963
commit
ad1dc1445f
3 changed files with 12 additions and 10 deletions
|
|
@ -1,4 +1,5 @@
|
|||
/* global CloudCmd */
|
||||
/* global CloudFunc */
|
||||
/* global DOM */
|
||||
|
||||
(function() {
|
||||
|
|
@ -54,7 +55,9 @@
|
|||
|
||||
uploader = window.philip(entries, function(type, name, data, i, n, callback) {
|
||||
var upload,
|
||||
full = path + name;
|
||||
prefixURL = CloudCmd.PREFIX_URL,
|
||||
FS = CloudFunc.FS,
|
||||
full = prefixURL + FS + path + name;
|
||||
|
||||
switch(type) {
|
||||
case 'file':
|
||||
|
|
|
|||
|
|
@ -406,13 +406,16 @@ var CloudCmd, Util, DOM, CloudFunc;
|
|||
|
||||
load = function(file, callback) {
|
||||
var uploader,
|
||||
Images = DOM.Images,
|
||||
name = file.name,
|
||||
path = dir + name;
|
||||
Images = DOM.Images,
|
||||
name = file.name,
|
||||
path = dir + name,
|
||||
prefixURL = CloudCmd.PREFIX_URL,
|
||||
FS = CloudFunc.FS,
|
||||
api = prefixURL + FS;
|
||||
|
||||
++i;
|
||||
|
||||
uploader = DOM.load.put(path, file);
|
||||
uploader = DOM.load.put(api + path, file);
|
||||
uploader.on('progress', function(count) {
|
||||
var max = step(n),
|
||||
value = (i - 1) * max + percent(count, 100, max);
|
||||
|
|
|
|||
|
|
@ -219,16 +219,12 @@
|
|||
|
||||
load.put = function(url, body) {
|
||||
var emitter = Emitify(),
|
||||
prefix = CloudCmd.PREFIX,
|
||||
apiURL = CloudFunc.apiURL,
|
||||
|
||||
api = prefix + apiURL + '/fs',
|
||||
xhr = new XMLHttpRequest();
|
||||
|
||||
url = encodeURI(url);
|
||||
url = url.replace('#', '%23');
|
||||
|
||||
xhr.open('put', api + url, true);
|
||||
xhr.open('put', url, true);
|
||||
|
||||
xhr.upload.onprogress = function(event) {
|
||||
var percent, count;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue