Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了angular-filemanager API docs大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

https://github.com/joni2BACk/angular-filemanager/blob/master/API.md


angular-filemanager API docs [multiple file support]

LisTing (URL: fileManagerConfig.listurl,Method: POST)

JSON request content

{
    "action": "list","path": "/public_html"
}

JSON Response

{ "result": [ 
    {
        "name": "@H_825_17@magento","rights": "drwxr-xr-x","size": "4096","date": "2016-03-03 15:31:40","type": "dir"
    },{
        "name": "index.PHP","rights": "-rw-r--r--","size": "549923","type": "file"
    }
]}

Rename (URL: fileManagerConfig.renameUrl,Method: POST)

JSON request content

{
    "action": "rename","item": "/public_html/index.PHP","newItemPath": "/public_html/index2.PHP"
}

JSON Response

{ "result": { "success": true,"error": null } }

@L_348_7@move (URL: fileManagerConfig.moveUrl,Method: POST)

JSON request content

{
    "action": "@H_825_17@move","items": ["/public_html/libs","/public_html/config.PHP"],"newPath": "/public_html/includes"
}

JSON Response

{ "result": { "success": true,"error": null } }

Copy (URL: fileManagerConfig.copyUrl,Method: POST)

JSON request content

{
    "action": "copy","items": ["/public_html/index.PHP","newPath": "/includes","singleFilename": "renamed.PHP" <-- (only present in single SELEction copy)
}

JSON Response

{ "result": { "success": true,"error": null } }

Remove (URL: fileManagerConfig.removeUrl,Method: POST)

JSON request content

{
    "action": "remove","items": ["/public_html/index.PHP"],}

JSON Response

{ "result": { "success": true,"error": null } }

Edit file (URL: fileManagerConfig.editUrl,Method: POST)

JSON request content

{
    "action": "edit","content": "<?PHP echo random(); ?>"
}

JSON Response

{ "result": { "success": true,"error": null } }

Get content of a file (URL: fileManagerConfig.getContentUrl,Method: POST)

JSON request content

{
    "action": "getContent","item": "/public_html/index.PHP"
}

JSON Response

{ "result": "<?PHP echo random(); ?>" }

Create folder (URL: fileManagerConfig.createFolderUrl,Method: POST)

JSON request content

{
    "action": "createFolder","newPath": "/public_html/new-folder"
}

JSON Response

{ "result": { "success": true,"error": null } }

Set permissions (URL: fileManagerConfig.permissionsUrl,Method: POST)

JSON request content

{
    "action": "changePermissions","items": ["/public_html/root","/public_html/index.PHP"],"perms": "653","permsCode": "rw-r-x-wx","recursive": true
}

JSON Response

{ "result": { "success": true,"error": null } }

Compress file (URL: fileManagerConfig.compressUrl,Method: POST)

JSON request content

{
    "action": "compress","items": ["/public_html/photos","/public_html/docs"],"desTination": "/public_html/BACkups","compressedFilename": "random-files.zip"
}}

JSON Response

{ "result": { "success": true,"error": null } }

Extract file (URL: fileManagerConfig.extractUrl,Method: POST)

JSON request content

{
    "action": "extract","desTination": "/public_html/extracted-files","item": "/public_html/compressed.zip"
}

JSON Response

{ "result": { "success": true,"error": null } }

Upload file (URL: fileManagerConfig.uploadUrl,Method: POST,Content-Type: multipart/form-data)

http post request payload

------WebKitFormBoundaryqBnbHc6RKfXVAf9j
Content-Disposition: form-data; name="desTination"
/

------WebKitFormBoundaryqBnbHc6RKfXVAf9j
Content-Disposition: form-data; name="file-0"; filename="github.txt"
Content-Type: text/plain

JSON Response

{ "result": { "success": true,"error": null } }

Unlimited file items to upload,each item will be enumerated as file-0,file-1,etc.

For example,you may retrieve the file in PHP using:

$desTination = $_POST['desTination'];
$_FILES['file-0'] or foreach($_FILES)

Download / Preview file (URL: fileManagerConfig.downloadMultipleUrl,Method: GET)

http query params

[fileManagerConfig.downloadFileUrl]?action=download&path=/public_html/image.jpg

Response

-File content

Download multiples files in ZIP/TAR (URL: fileManagerConfig.downloadFileUrl,Method: GET)

JSON request content

{
    "action": "downloadMultiple","items": ["/public_html/image1.jpg","/public_html/image2.jpg"],"toFilename": "@H_825_17@multiple-items.zip"
}}

Response

-File content
Errors / Exceptions

Any BACkend error should be with an error 500 http code.

Btw,you can also report errors with a 200 response both using this json structure

{ "result": {
    "success": false,"error": "Access denied to remove file"
}}

大佬总结

以上是大佬教程为你收集整理的angular-filemanager API docs全部内容,希望文章能够帮你解决angular-filemanager API docs所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。