Skip to content

Thêm WebDAV Channel

Phù hợp nhất khi nào

Dùng WebDAV channel khi:

  • Bạn có NAS, cloud drive hoặc object storage service cung cấp WebDAV endpoint.
  • Bạn muốn uploaded images được lưu trong WebDAV directory của riêng mình.
  • Bạn muốn credentials được lưu trong D1 upload_channels table thay vì expose lâu dài ở frontend.

Cần chuẩn bị gì trước khi bắt đầu

RequirementPurpose
WebDAV EndpointServer-side WebDAV URL, ví dụ https://nas.example.com/dav.
UsernameDùng để sign in vào WebDAV service.
PasswordDùng để sign in vào WebDAV service.
Authentication modeMặc định là Basic. Chỉ dùng Digest hoặc auto negotiation nếu server yêu cầu.
Storage directoryDirectory dùng để lưu files. Mặc định là imgbed.

Thêm ở đâu

  1. Mở System Settings.
  2. Vào Upload Settings.
  3. Nhấn Add Channel ở góc trên bên phải.
  4. Chọn WebDAV.

Field Reference

FieldTác dụngRequired
Channel nameTên dễ nhận biết cho WebDAV channel, ví dụ koofr hoặc nas.Yes
EndpointFull WebDAV endpoint, bao gồm https://.Yes
UsernameWebDAV login username.Yes
PasswordWebDAV login password.Yes
Authentication modeThường dùng Basic; dùng Digest nếu server yêu cầu digest authentication.Yes
Storage directoryDirectory nơi files được lưu. Mặc định là imgbed.No

Example: fie.nl.tab.digital

1. Tạo App Password

Mở account security settings, tìm application passwords và tạo app password mới.

Create an app password

Sau khi tạo, copy và lưu app password mới. Thường password này chỉ hiện một lần.

Save the new app password

2. Điền WebDAV Configuration trong ImgBed

Quay lại ImgBed và thêm WebDAV channel:

UI FieldValue
EndpointWebDAV URL do https://fie.nl.tab.digital/ cung cấp.
UsernameWebDAV username của bạn.
PasswordApp password vừa tạo.
Authentication modeHầu hết trường hợp bắt đầu với Basic.
Storage directoryMặc định là imgbed; cũng có thể dùng custom directory.

Fill in the configuration

Hành vi upload file lớn

WebDAV channel hiện dùng real session-based chunked upload.

Files nhỏ được upload dưới dạng một complete file. Files lớn hơn 64 MiB sẽ tự động được chia thành chunks khoảng 10 MiB và upload vào remote chunk directory.

WebDAV service không cần hỗ trợ partial update hoặc offset-based writes. ImgBed không merge chunks thành một large file trên remote server. Thay vào đó, ImgBed lưu chunk manifest và đọc chunks theo thứ tự khi file được request.

Thực tế:

File SizeUpload MethodRemote Storage Layout
64 MiB hoặc nhỏ hơnNormal uploadMột complete file
Lớn hơn 64 MiBReal session chunked uploadMột chunk directory chứa nhiều chunk files

Chunk directory chỉ ảnh hưởng đến remote storage layout. File URL trong ImgBed không đổi. Users vẫn access file bằng link /file/... ban đầu.

Các bước thiết lập

  1. Mở Upload Settings.
  2. Nhấn Add Channel.
  3. Chọn WebDAV.
  4. Nhập channel name dễ nhận biết, ví dụ koofr.
  5. Nhập WebDAV endpoint, ví dụ https://app.koofr.net/dav/Koofr.
  6. Nhập username và password.
  7. Giữ authentication mode là Basic theo mặc định.
  8. Giữ storage directory là imgbed, hoặc đổi sang directory của bạn.
  9. Nhấn Save.
  10. Sau khi save, kiểm tra channel card, query capacity nếu có, và upload test file.

Cách kiểm tra

CheckCách kiểm tra
Channel card xuất hiệnSau khi save, trang Upload Settings cần hiển thị WebDAV channel card.
Channel enabledSwitch ở góc trên bên phải card nên ở trạng thái on.
Credentials đã lưuDetail view cần hiển thị Endpoint, username, authentication mode và storage directory.
Small file upload hoạt độngUpload test image và xác nhận file xuất hiện trong WebDAV directory.
Large file rule hoạt độngFiles lớn hơn 64 MiB dùng chunked upload và tạo remote chunk directory.
Capacity query hoạt độngNếu server hỗ trợ capacity information, query sẽ hiển thị used và total capacity.

Quota query succeeded

FAQ

Vì sao large WebDAV files tạo chunk directory?

Đây là storage method hiện tại cho large files.

Files lớn hơn 64 MiB không được merge thành một remote file lớn. Chúng được lưu dưới dạng chunk directory. ImgBed ghi chunk manifest và trả về complete content bằng cách đọc chunks theo thứ tự.

Large file upload fail thì nên kiểm tra gì trước?

Trước hết kiểm tra Endpoint, username, password và storage directory. Sau đó xác nhận WebDAV service cho phép tạo directory, ghi file và đọc file.

Nếu capacity query fail nhưng small file upload vẫn hoạt động, server có thể đơn giản là không hỗ trợ hoặc giới hạn capacity reporting. Điều đó không nhất thiết có nghĩa upload không dùng được.

Nên dùng authentication mode nào?

Bắt đầu với Basic.

Nếu server yêu cầu digest authentication rõ ràng, dùng Digest.

Nếu không chắc, dùng automatic negotiation.

Quick Checklist

text
Chuẩn bị WebDAV endpoint, username và password
-> Mở Upload Settings
-> Add Channel
-> Chọn WebDAV
-> Nhập Endpoint / username / password
-> Giữ authentication mode là Basic theo mặc định
-> Giữ storage directory là imgbed theo mặc định
-> Save
-> Query capacity
-> Upload test file

Released as user documentation for CloudFlare ImgBed.