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

FileUpload: Some files are missing when uploading multiple files #13306

Open
uma-ac opened this issue Jun 18, 2024 · 5 comments
Open

FileUpload: Some files are missing when uploading multiple files #13306

uma-ac opened this issue Jun 18, 2024 · 5 comments

Comments

@uma-ac
Copy link

uma-ac commented Jun 18, 2024

FileUploadMissingFile
FileUploadMissingFile_temp
Screenshot 2024-06-18 at 10 33 41

Package

filament/filament

Package Version

3

Laravel Version

11

Livewire Version

V3

PHP Version

php 8

Problem description

When I upload multiple files, some of the files are missing.

Expected behavior

All the files should be present in the desired folder.

Steps to reproduce

Section::make('') ->relationship('result_files') ->schema([ FileUpload::make('attachments') ->columnSpan(12) ->multiple() ->maxSize(100000) ->disk('uploads') ->directory('result_files') ->acceptedFileTypes(["application/pdf"]) ->getUploadedFileNameForStorageUsing(function ($file): string { $fileName = str($file->getClientOriginalName()); $fileName_str = preg_replace('/[^a-zA-Z0-9.]/','',iconv('UTF-8', 'ASCII//TRANSLIT', $fileName)); return (string) str($fileName_str)->prepend(now() . '-'); }) ->downloadable() ->rules([ new MalwareFile] ) ->label(__('application.resource.result_documents')) ]),

FileUpload::make('attachments') ->columnSpan(12) ->multiple() ->maxSize(100000) ->disk('uploads') ->visibility('private') ->directory('application_files') ->getUploadedFileNameForStorageUsing(function ($file): string { $fileName = str($file->getClientOriginalName()); $fileName_str = preg_replace('/[^a-zA-Z0-9.]/','',iconv('UTF-8', 'ASCII//TRANSLIT', $fileName)); return (string) str($fileName_str)->prepend(now() . '-'); }) ->downloadable() ->rules([ new MalwareFile] ) ->label(__('application.resource.application_documents')),

livewire.php

'temporary_file_upload' => [ 'disk' => 'tmp', // Example: 'local', 's3' | Default: 'default' "rules" => "file|mimes:pdf,jpg,jpeg,png,doc,docx,svg,mp4,mp3 | max:100000", // 'rules' => 'max:100000', // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB) 'directory' => null, // Example: 'tmp' | Default: 'livewire-tmp' 'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1' 'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs... 'png', 'gif', 'bmp', 'svg', 'wav', 'mp4', 'mov', 'avi', 'wmv', 'mp3', 'm4a', 'jpg', 'jpeg', 'mpga', 'webp', 'wma', 'pdf' ], 'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated... ],

Reproduction repository (issue will be closed if this is not valid)

https://github.com/guma-005/Filament-issue.git

Relevant log output

No response

Donate 💰 to fund this issue

  • You can donate funding to this issue. We receive the money once the issue is completed & confirmed by you.
  • 100% of the funding will be distributed between the Filament core team to run all aspects of the project.
  • Thank you in advance for helping us make maintenance sustainable!
Fund with Polar
@uma-ac uma-ac added bug Something isn't working medium priority unconfirmed labels Jun 18, 2024
@zepfietje zepfietje added this to the v3 milestone Jun 18, 2024
@zepfietje
Copy link
Member

Please provide a non-empty reproduction repository.

@zepfietje zepfietje closed this as not planned Won't fix, can't repro, duplicate, stale Jun 18, 2024
@uma-ac
Copy link
Author

uma-ac commented Jun 18, 2024

updated repository

@danharrin
Copy link
Member

Please attach the files you were uploading and explain what disk you use

@danilogiacomi
Copy link

Hi this happened to me as well, I have a different scenario and was able to find the culprit (but not a solution).

In my example I have an action opening a modal with the FileUpload in its form and the creation of one entities for each uploaded file (within the action itself).

The Resource, then, has a relationManager with the entities created in the above-mentioned action.

If in the relationManager we add a ->poll('5s') then the issue appears, if we don't it works flawlessly.

I've created a repo with the two versions of the Resources so you can try it out both the working and the non-working version.

Please find the repository at the following URL, I've added a little instruction in the README and it also is shipped with some test files to be uploaded, for your convenience.

https://github.com/danilogiacomi/filamentFileUploadProblem

@PegeDev
Copy link

PegeDev commented Sep 29, 2024

any update for this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

5 participants