# 管理端文件预览接口(更新)
**日期**: 2026-03-23
**类型**: 接口更新
---
## 接口
```
GET /admin/file/preview-by-url?url=编码后的完整OSS_URL
```
**无需登录,无需 token。**
## 返回内容
直接返回**原始文件二进制流**(与 `/{fileId}/preview` 一致):
- PDF → Content-Type: application/pdf
- 图片 → Content-Type: image/jpeg 等
- 其他 → 对应 MIME 类型
## 前端使用
```javascript
// iframe 嵌入(推荐,PDF和图片都能直接显示)
// 或新窗口打开
window.open(`/api/admin/file/preview-by-url?url=${encodeURIComponent(ossUrl)}`)
// 或 img 标签(仅图片)
```
**注意**:url 参数必须 `encodeURIComponent` 编码。