Path: API › 文件管理

`POST /files`

为文件或目录创建软链接（符号链接 symlink）。

## Request body

_Required._

- `action121.request_time` (string, required) — Unix 时间戳。
- `action121.request_token` (string, required) — 按 API 概览生成的签名。
- `action121.action` (string, required) — 具体操作名称。
  - one of `"CreateLink"`
- `action121.sfile` (string, required) — 源文件或目录的绝对路径
- `action121.dfile` (string, required) — 软链接目标路径（绝对路径），文件名仅允许 `[\w\-\.]+`

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "CreateLink",
  "sfile": "string",
  "dfile": "string"
}
```

## Code samples

### cURL（填写面板地址与签名）

```curl
curl --request POST \
  --url "https://your-panel.example.com:8888/files" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "request_time=<Unix时间戳>" \
  --data-urlencode "request_token=<按 API 概览生成的签名>" \
  --data-urlencode "action=CreateLink" \
  --data-urlencode "sfile=<sfile>" \
  --data-urlencode "dfile=<dfile>"
```

## Responses

### default

接口响应，业务状态见下方详细说明。

#### Example

```json
{
  "status": true,
  "msg": "软链文件创建成功!"
}
```

- `action121.response.default.status` (boolean, optional) — `true` 创建成功
- `action121.response.default.msg` (string, optional) — `软链文件创建成功!`


## CreateLink

为文件或目录创建软链接（符号链接 symlink）。

- **路由**：`POST /files`
- **action**：`CreateLink`

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `CreateLink` |
| sfile | 是 | String | 源文件或目录的绝对路径 |
| dfile | 是 | String | 软链接目标路径（绝对路径），文件名仅允许 `[\w\-\.]+` |

## 输出参数

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| status | Boolean | `true` 创建成功 |
| msg | String | `软链文件创建成功!` |

## 示例

### 请求

```
POST /files HTTP/1.1
Host: 192.168.168.213:8888
Content-Type: application/x-www-form-urlencoded

action=CreateLink&sfile=/www/wwwroot/testapi.bt.local&dfile=/tmp/bt_link_test
```

### 响应

```json
{"status": true, "msg": "软链文件创建成功!"}
```

