ankitpokhrel / ankitpokhrel/tus-php

Unable to upload files - PATCH GONE

Ouverte
#416 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
inactive
Langage dominant
PHP
Étoiles
1.5k
Forks
220
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.