Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to upload files - PATCH GONE #416

Open
Aiosa opened this issue Nov 9, 2022 · 1 comment
Open

Unable to upload files - PATCH GONE #416

Aiosa opened this issue Nov 9, 2022 · 1 comment
Labels

Comments

@Aiosa
Copy link

Aiosa commented Nov 9, 2022

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

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

file_loader.js:283 Chunk error! Error: tus: unexpected response while uploading chunk, originated from request (method: PATCH, url: <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 curling 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.

@github-actions
Copy link

github-actions bot commented Jan 9, 2023

This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant