• Home
Name Date Size #Lines LOC

..--

entry/12-May-2024-1,2741,132

screenshots/devices/12-May-2024-

.gitignoreD12-May-2024121 88

README.mdD12-May-20241.4 KiB4124

README_zh.mdD12-May-20241.4 KiB4225

build-profile.json5D12-May-20241 KiB4341

hvigorfile.jsD12-May-2024174 21

package.jsonD12-May-2024394 1919

README.md

1# Upload/Download
2
3### Introduction
4
5This sample demonstrates how to use the upload and download interfaces to upload and download files.
6
7![](screenshots/devices/index.png)
8
9### Concepts
10
11**Upload and download**
12
13  Transfer files from a mobile phone to a remote server and vice versa.
14
15### Required Permissions
16
17The following permission must be declared in the **config.json** file:
18
19"reqPermissions": [{"name": "ohos.permission.INTERNET"}]
20
21### Usage Guidelines
22
231. Start the application and request for access to the remote server. A list of files on the remote server will be displayed. Select the file to download and click **download**. The file on the remote server is downloaded to the mobile phone, and the download progress is displayed.
24
252. Tap **next** to go to the upload page, and tap **upload**. The local file is uploaded to the remote server, and the upload progress is displayed.
26
27### Constraints
28
291. This sample can only be run on standard-system devices.
30
312. This sample requires DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022) to compile and run.
32
333. HTTPS is supported by default. To support HTTP, you need to add the **network** field to the **config.json** file, and set the **cleartextTraffic** attribute to **true**, that is:
34"deviceConfig": {
35    "default": {
36        "network": {
37            "cleartextTraffic": true
38        }
39    }
40}
41

README_zh.md

1# 上传下载
2
3### 介绍
4
5 上传就是将文件从本地设备传送至远程服务器,下载是将文件从远程服务器传送至本地设备存储,该示例使用上传下载的接口实现文件的上传下载。
6
7使用方法:
8
91.启动应用,获取权限后系统会访问远程服务器,将远程服务器的文件列表显示,选择要下载到本机的文件,点击**点击下载**按钮,远端服务器的文件就会下载到本机,文件的下载进度下方会显示。
10
112.点击下一页,页面会跳转到上传页面,点击**点击上传**按钮,本机的文件会上传至远端服务器,上传进度下方会显示。
12
13### 效果预览
14
15![](screenshots/devices/index.png)
16
17### 相关权限
18
19网络相关权限:ohos.permission.INTERNET
20
21### 依赖
22依赖于[上传下载服务器](https://gitee.com/adslk/application_server/tree/master/UploadDownloadServer)才能实现具体的上传下载功能。
23
24### 约束与限制
25
261.本示例仅支持标准系统上运行。
27
282.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。
29
303.默认支持https,如果要支持http,需要在config.json里增加network标签,属性标识 "cleartextTraffic": true。即:
31
32```
33"deviceConfig": {
34    "default": {
35        "network": {
36            "cleartextTraffic": true
37        }
38    }
39}
40```
41
42