Loading…

File upload and management

# Select local album/camera ```javascript tt.chooseImage({ success(res) { this.setData({ images: res.tempFilePaths // This is needed for uploading images for subsequent cloud development, please save it. }); }, fail(res) { console.log(`chooseImage call failed`); } }); ``` # Cloud development upload files ```javascript const res = await TTAPI.uploadFile(tempFilePath) // tempFilePath is res.tempFilePaths returned after selecting the picture above console.log(res) //Interface return ``` Return example of res: ```json { "code": 0, "data": { "msg": "SUCCESS", "originalName": "73b3dedc75be71738454542d29c0b594.png", "size": "569099", "name": "cuser/951/2020/01/03/f641e7c9-adae-41b1-96eb-df356b8c385f.png", "type": ".png", "url": "https://dcdn.it120.cc/cuser/951/2020/01/03/f641e7c9-adae-41b1-96eb-df356b8c385f.png" }, "msg": "success" } ``` #Backend management ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1578011953610-9d67a1a6-bbda-4b14-98b0-75243061c682.png)