Comments (13)
@s1rc I added a rough doc for Laravel integration: https://github.com/ankitpokhrel/tus-php/wiki/Laravel-&-Lumen-Integration
from tus-php.
Thank you, I will give this a try!
from tus-php.
So far so good!
One quick change to your Wiki article. In the route definition, the parameter needs to be optional.
Route::any('/tus/{any?}', function () {
$response = app('tus-server')->serve();
return $response->send();
})->where('any', '.*');
from tus-php.
Yes true, thanks :)
from tus-php.
Not sure if I should open a new issue, but do have some follow up questions.
- Where are the files stored during upload? In the redis cache?
- If using redis cache I cannot resume, if using file cache upload finishes 100% immediately. (both using Uppy)
- Is there a completion handler for the server? I want to perform some post upload actions (i.e. add to a media library and remove from the tus upload directory)
from tus-php.
-
Files are stored in the location you specify while setting up the server. By default, it uses
uploads
folder in the installation directory.->setUploadDir(storage_path('app/public/uploads')); // upload dir
-
Make sure that
tus-server
can connect the redis server. You can useREDIS_HOST
andREDIS_PORT
env to pass redis host and port. You can also directly create and pass redis object.// TusServiceProvider.php $redis = new TusPhp\Cache\RedisStore([ 'host' => '127.0.0.1', 'port' => '6379', ]); $server = new Server($redis);
if using file cache upload finishes 100% immediately
I guess you are testing in your local setup. This is related to uppy and the reason is that the progress bar is updated as soon as the first byte is sent to the server. This process is too fast in local and it reaches 100% immediately. If you use actual server this won't happen.
-
No there isn't but if you are using uppy you can use
upload-success
event for post upload operations.
from tus-php.
- I have it set to the following, and that's where the files end up after completion. I can see when at 100% the files are being copied into that directory, however I can't find the partially uploaded files.
$server
->setApiPath('/tus')
->setUploadDir(storage_path('tus'));
-
I can see that redis is working locally, since I am connected to it in a viewer and the records are visible. When I run run with the default files cache the upload is instantly 100% but nothing ends up in the upload dir.
-
Ok I understand, so I'd have to have Uppy perform another API call and then send the delete event to the Tus server.
from tus-php.
Hi @s1rc,
I just tried in one of my Laravel's installation and it seems to be working fine. I hope you properly setup your tus endpoint for uppy.
const uppy = Uppy.Core({debug: true, autoProceed: false})
.use(Uppy.Dashboard, {target: '#uppyUploader', inline: true})
.use(Uppy.Tus, {endpoint: 'http://your.app/tus'}) // tus endpoint
.run()
Note that if you upload same file again while was successfully uploaded previously it won't get uploaded unless you clear your redis or file cache. File cache is saved in .cache/tus_php.cache
.
Flush your cache first and then try uploading some large files and pause it after a while even if uppy shows 100%. You should see partially uploaded file in your uploads dir. Resume it again and when the upload completes, you should be able to see the complete file.
from tus-php.
I set it up exactly as you wrote the Wiki.
I've tried file cache and deleting vendor/ankitpokhrel/tus-php/.cache/tus_php.cache
, as well as deleting all records from redis when using redis config.
During upload there are no partially uploaded files in the folder defined at setUploadDir(storage_path('tus'))
I've tried setting the Laravel environment cache to file and redis, no change.
You can see here that pausing and resuming the file just starts over
https://ufile.io/dv2ao
And when a file is at 100% there is a long pause while the file is copied into the folder defined at ``setUploadDir(storage_path('tus'))`
https://ufile.io/ilv9p
from tus-php.
Hi @s1rc,
The progress bar is updated by uppy as soon as the first byte is sent to the server and don't wait for the actual byte to be updated. This process is very quick in local so the progress bar reaches 100% immediately. This won't happen in actual server as there will be lag when sending first byte to the server.
You can see here that pausing and resuming the file just starts over
I see that the file is 2.5gb which will take some time to upload (even partially). Try by uploading small file lets say 50 mb. When the progress bar reaches 100%, wait for 2-3 seconds and pause it, there should be partially uploaded file in your uploads dir.
And when a file is at 100% there is a long pause while the file is copied into the folder
There is long pause because file is now actually being uploaded to the server. Again, this happens only in local because of the way uppy progress bar works.
If you have a test server, I recommend you to check on that and things will be clear for you.
I know this is confusing but it happens only in local and I haven't found a way to fixed that yet. If you can figure out how to fix it that would be a great help. I will try to check with uppy team later.
from tus-php.
@ankitpokhrel thanks for the feedback.
I tested it on a development server on AWS and it does seem to be working better.
from tus-php.
I will try to replicate the issue as soon as I get some time and will get back to you
from tus-php.
Closed in favor of #44
from tus-php.
Related Issues (20)
- File based cache - tus_php.server.cache empty - 410 Error HOT 5
- Continue file upload from different browser and device HOT 3
- How to protect single file link? HOT 2
- CakePHP integration does not work HOT 2
- How can I do Cloudflare Integration? HOT 2
- Location header set to http when deployed behind reverse proxy HOT 2
- Unable to upload files - PATCH GONE HOT 1
- Getting Started Documentation
- Allow PHP 8+ for version 1.x.x
- Checksum implementation does not match TUS specification
- Enable to update to PHP 8.1 due to version constraint
- Documentation, Please!
- validating file mime type
- Headers can be totally configurable HOT 1
- Please kindly explain this code to me HOT 1
- Password protected Redis
- Possible bug or configuration issue? HOT 3
- Unable to create resource.
- PHP 8.1+ support HOT 3
- Laravel Octane support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tus-php.