ankitpokhrel / ankitpokhrel/tus-php

Unable to upload files - PATCH GONE

Đang mở
#416 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
inactive
Ngôn ngữ chính
PHP
Star
1.5k
Fork
220
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hello, I am unable to set up the server properly so that it uploads files.

> tus.min.js:1 PATCH \ 410 (Gone)

> file_loader.js:283 Chunk error! Error: tus: unexpected response while uploading chunk, originated from request (method: PATCH, url: \, response code: 410, response text: , request id: n/a)

I am using client as follows:
```
const upload = new tus.Upload(file, {
endpoint: "server/tus/",
retryDelays: [0, 3000, 5000, 10000, 20000],
chunkSize: this.chunkUploadSizeLimit,
metadata: {
name: file.name,
type: file.type,
fileName: file.name,
relativePath: relativePath,
},
onError: (e) => { ... },
onProgress: (bytesUploaded, bytesTotal) => {
let percentage = Math.round(bytesUploaded / bytesTotal * 100);
self._onUploadProgress(bytesTotal, percentage);
},
onSuccess: () => { .... }
});
```
And the server:

```
require("../vendor/autoload.php");
require_once "../config.php";
$server = new \TusPhp\Tus\Server('file');
$server->setUploadDir($tmp_dir);
$response = $server->serve();
$response->send();
exit(0);
```

The client lives two directories up relative to the tus server so that relative path to `server/tus/` runs the `index.php` from above. The same directory also contains the access rules:
```
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^files/?(.*)?$ index.php?$1 [QSA,L]
```

- The uploading progress bar reaches 100% and then shows the error with PATCH 410 GONE
- I tried `curl`ing `OPTIONS (200) HEAD (404) POST (400) PATCH (410) DELETE (404)` with a non-existing key (since I did not upload any file successfully yet)
- The upload directory is writable, `tus_php.server.cache` was created
- Not setting the directory gave me error about not being able to open files in `..vendor/ankitpokhrel/tus-php/uploads` so I guess it is set up correctly
- The rewrite rules should be OK, tested redirection to a 'print it to me' php script

Thank you for your help.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.