docblue / chfsgui

This is just a GUI WRAPPER for chfs(cute http file server)
GNU Lesser General Public License v3.0
833 stars 135 forks source link

软件的api不懂如何使用 #14

Open 1965514404 opened 4 years ago

1965514404 commented 4 years ago

额,很抱歉打扰你,不知道你是否还在,软件给出的api并不知道要如何使用,在获取列表和下载那里很轻松就可以了,可是在上传那里无论如何都是返回错误参数,通过抓包在用curl命令去上传也是失败的,所以请求完善一下api或者给个curl的命令用法,麻烦了

docblue commented 4 years ago

比如上传文件D:/foo:

CURL: curl --location --request POST 'http://localhost/chfs/upload' --form 'folder=/' --form 'file=@/D:/foo'

JS: var data = new FormData(); data.append("folder", "/"); data.append("file", fileInput.files[0], "/D:/foo");

var xhr = new XMLHttpRequest(); xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() { if(this.readyState === 4) { console.log(this.responseText); } });

xhr.open("POST", "http://localhost/chfs/upload");

xhr.send(data);

在 2020-10-13 15:14:26,"icesvalley" notifications@github.com 写道:

额,很抱歉打扰你,不知道你是否还在,软件给出的api并不知道要如何使用,在获取列表和下载那里很轻松就可以了,可是在上传那里无论如何都是返回错误参数,通过抓包在用curl命令去上传也是失败的,所以请求完善一下api或者给个curl的命令用法,麻烦了

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

1965514404 commented 4 years ago

请问,我手机要传文件给电脑,文件是/sdcard/1.txt, 用curl要如何做

1965514404 commented 4 years ago

M` `92`49XI}X27334S4SYD

1965514404 commented 4 years ago

`4@66I1K`$544DLSSZ@FH1X

1965514404 commented 4 years ago

电脑用curl还是不行,,,

1965514404 commented 4 years ago

你好请问api删除文件要怎么弄,我删除的时候总会把文档下全部文件删除

aonoa commented 3 years ago
curl --location --request POST 'http://xxx.xxxx.xx/chfs/upload' \
--header 'Cookie: JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2MiOiJmb3giLCJleHAiOjE2MDY0NjA1NDB9.2W7Dkfmm1YxjwD_UeGu6Xwa3Ur8T7h1C7hEVotbSL_8' \
--form 'file=@/C:/Users/xxxxxxx/AppData/Local/Postman/app-7.31.1/SquirrelSetup.log' \
--form 'folder=/'

Cookie 登录后获取的Token
file 要上传的文件
folder 上传的目录