can we add job when uploading large size files in file upload

This is my code.. When i am uploading larger size its taking too much time and still not uploading after more than 5mins ..can we add job for uploading file
FileUpload::make('video_url')
->required()
->label('Upload Video')
->disk('s3')
->maxSize(500000)
->directory('mobile-assets/highlights')
->visibility('private'),
FileUpload::make('video_url')
->required()
->label('Upload Video')
->disk('s3')
->maxSize(500000)
->directory('mobile-assets/highlights')
->visibility('private'),
18 Replies
_Lietze
_Lietze12mo ago
I think your best bet is using actions. i usually add a headeraction, and chain an action like so:
Action::make('upload')
->label('Upload File')
->form([
FileUpload::make('upload')
->yourmethods()
])
->action(function (array $data): void {
ImportCustomDataJob::dispatch($data['upload']);
});
Action::make('upload')
->label('Upload File')
->form([
FileUpload::make('upload')
->yourmethods()
])
->action(function (array $data): void {
ImportCustomDataJob::dispatch($data['upload']);
});
Helge Sverre
Helge Sverre12mo ago
I wish there was a way for an action to itself be the file selector trigger So you'd click "upload" (the action button), the file selector shows up, and then you can either use that in a form, or just trigger an action straight away with the selected file. im sure it's probably doable as a custom field or something, but meh, dont have time to build it myself atm.
_Lietze
_Lietze12mo ago
That's what my code does right? or i'm misunderstanding
Helge Sverre
Helge Sverre12mo ago
yours opens a modal where the file upload is a field, what iwant is to skip the modal part, and simply by clicking the action button it opens the file selector (finder/explorer) and then submits the action, or opens the form with the file pre-filled so skipping 1 step kind of instead of clicking upload- > open modal -> click file selector you go click upload -> file selector -> form or action with file already selected
_Lietze
_Lietze12mo ago
ahh like that... hmm not sure. Pretty sure you'd have to make a custom livewire component indeed
Helge Sverre
Helge Sverre12mo ago
but maybe one can fudge it by triggering the file input via $this->js("click the input") when the modal opens automatically but anyways, ramble from my side.
_Lietze
_Lietze12mo ago
wouldn't be the most beautiful code, but it might work :p
Helge Sverre
Helge Sverre12mo ago
Would be useful for stuff where the primary action starts with an upload, and everything else comes after type of stuff
Alnuaimi
Alnuaimi12mo ago
Hi why not get data her?
No description
Helge Sverre
Helge Sverre12mo ago
what does $data output?
Alnuaimi
Alnuaimi12mo ago
role name or id
Helge Sverre
Helge Sverre12mo ago
what do you expect it to output?
_Lietze
_Lietze12mo ago
tip: use the dd() function instead of echo, print_r and die() dd = Dump and Die, basically a prettier, more readable output that just echoing but could you show us the dd() output?
awcodes
awcodes12mo ago
Please don’t hi-jack other people’s questions.
Alnuaimi
Alnuaimi12mo ago
brother ok no probelm for any one function to use I wanaa to get $data value why not work it
_Lietze
_Lietze12mo ago
@Alnuaimi I'm not fully understanding your question, but could you create your own post? others can help you that way and this thread will stay organized 🙂
Alnuaimi
Alnuaimi12mo ago
brother look at image this why not get value in this action
No description
Carl-bot
Carl-bot12mo ago
alnuaimi0512 has been warned, this is their first warning.
Want results from more Discord servers?
Add your server