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: Needed Event: onBeforeSelect #3134

Closed
ozkanazazi opened this issue Aug 4, 2022 · 5 comments · Fixed by #3135
Closed

FileUpload: Needed Event: onBeforeSelect #3134

ozkanazazi opened this issue Aug 4, 2022 · 5 comments · Fixed by #3135
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@ozkanazazi
Copy link

ozkanazazi commented Aug 4, 2022

Describe the feature you would like to see added

When using custom template and adding multiple files I want to make some controls before file listed as an item.

Is your feature request related to a problem?

No response

Describe the solution you'd like

If my controls fail then I want to return false so I don't want to see the file in the file list

Describe alternatives you have considered

No response

Additional context

No response

@ozkanazazi ozkanazazi added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Aug 4, 2022
@ozkanazazi ozkanazazi changed the title Component: FileUpload Event: onBeforeSelect Component: FileUpload Needed Event: onBeforeSelect Aug 4, 2022
@ozkanazazi ozkanazazi changed the title Component: FileUpload Needed Event: onBeforeSelect Component: FileUpload - Needed Event: onBeforeSelect Aug 4, 2022
@melloware melloware changed the title Component: FileUpload - Needed Event: onBeforeSelect FileUpload: Needed Event: onBeforeSelect Aug 4, 2022
melloware added a commit to melloware/primereact that referenced this issue Aug 4, 2022
@melloware melloware self-assigned this Aug 4, 2022
@melloware melloware added this to the 9.0.0 milestone Aug 4, 2022
@ozkanazazi
Copy link
Author

Thank you very much

@melloware
Copy link
Member

No problem!

@mertsincan mertsincan modified the milestones: 9.0.0, 8.4.0 Aug 22, 2022
@sutherlandnele
Copy link

how do i get the list of files using onBeforeSelect prop. I cannot get it from the event object that is passed to the handler method. I am trying to validate the file size and file type uploaded using toast messages and not show invalid files in the pending file list of the FileUpload control.

I am using primereact version 9.2.3 which has the onBeforeSelect prop available. please assist.

@sutherlandnele
Copy link

I was able to get the list of files from event.originalEvent.target.files after much trial and error.

@melloware
Copy link
Member

yeah you can always console.log(event) to debug what is available in the event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants