ankitpokhrel / ankitpokhrel/tus-php
Unable to upload files - PATCH GONE
- Vorherrschende Sprache
- PHP
- Sterne
- 1.5k
- Forks
- 220
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.