Skip to content

How to check the file format issues when we upload file using storage browser -AmplifyUI #6352

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

Open
RutujaPhapale opened this issue Feb 13, 2025 · 3 comments
Labels

Comments

@RutujaPhapale
Copy link

Upload a non-CSV file and verify that the appropriate error message is displayed
I have tried using the getActionCompleteMessage: (files : File[]) => {
return { content : "Please upload a CSV file" , type : "warning"}},
But above warning message appears even when i user upload a CSV file , How can i check the fille format

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify UI maintainer labels Feb 13, 2025
@RutujaPhapale RutujaPhapale changed the title How to check the file format issues when we upload using storage browser How to check the file format issues when we upload file using storage browser Feb 13, 2025
@RutujaPhapale RutujaPhapale changed the title How to check the file format issues when we upload file using storage browser How to check the file format issues when we upload file using storage browser -AmplifyUI Feb 13, 2025
@tiffanynwyeung tiffanynwyeung added question General question StorageBrowser and removed pending-triage Issue is pending triage labels Feb 13, 2025
@tiffanynwyeung
Copy link
Member

Hi @RutujaPhapale! Would you mind providing more information on what you are trying to solve with uploading files using our Storage connected component, and what your current approach is? Any sample code on what you are trying to achieve would also be appreciated.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify UI maintainer label Feb 13, 2025
@RutujaPhapale
Copy link
Author

RutujaPhapale commented Feb 14, 2025

Hi @tiffanynwyeung , when a user uploads a non-csv file , message pop-ups-"all files failed to upload",
I want to change the message template-"We only acccept CSV files" , I tried changing the function getActionCompleteMessage
I have tried using the

getActionCompleteMessage: (files : File[]) => { 
      return { content : "Please upload a CSV file" , type : "warning"}},

But i think this function is responsible for any actions which gets completed though failed, overwrite and message it is giving even when the user uploads a CSV file, I tried giving the logic to check the message format for only .csv but it is not working.

My doubt is how can i check whether the file uploaded is NON-CSV and i will change message only for that.

I did below changes, but then i have to change message for each and every action, for example in below i have not described any message for Pending state then no message is displayed for pending, I want to only alter the failed state, but i need to change all because for other no message is showing.

 return <StorageBrowser
    displayText={{
      UploadView: {
        getActionCompleteMessage: ({ counts }) => {
          if (counts.COMPLETE > 0) {
            return { 
              content: "All files uploaded", 
              type: "success" 
            }
          };
          if (counts.OVERWRITE_PREVENTED > 0) {
            return {
              content: "Overwrite of files is prevented",
              type: "info"
            }
          };
          if (counts.FAILED > 0) {
            return {
              content: "We support only CSV files."
              type: "error"
            };
          }
          return undefined;
        },
}/>

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify UI maintainer label Feb 14, 2025
@cwomack
Copy link
Member

cwomack commented Feb 17, 2025

@RutujaPhapale, wanted to follow up here and let you know that we'll convert this issue to a feature request since this is an interesting and valid use case for Storage Browser.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify UI maintainer label Feb 17, 2025
@cwomack cwomack added feature-request Request a new feature and removed question General question labels Feb 17, 2025
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

3 participants