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

fix:complete the function of 'accept' option #455

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Coloey
Copy link

@Coloey Coloey commented Oct 17, 2022

const uploaderProps = {
  action: '/upload.do',
  data: { a: 1, b: 2 },
  multiple: true,
  beforeUpload(file) {
    console.log('beforeUpload', file.name);
  },
  onStart: file => {
    console.log('onStart', file.name);
  },
  onSuccess(file) {
    console.log('onSuccess', file);
  },
  onProgress(step, file) {
    console.log('onProgress', Math.round(step.percent), file.name);
  },
  onError(err) {
    console.log('onError', err);
  },
  capture: 'user',
  accept:'.jpg',
  directory: false
};

when I try to upload pictures in .jpg format, pictures in .png format can also be uploaded,and I try to solve this problem,here is my programme

 onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
    const { accept, directory } = this.props;
    const { files } = e.target;
    const acceptedFiles = [...files].filter(
      (file: RcFile) => !directory && attrAccept(file, accept),
    );
    this.uploadFiles(acceptedFiles);
    this.reset();
  };

@vercel
Copy link

vercel bot commented Oct 17, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
upload ✅ Ready (Inspect) Visit Preview Oct 17, 2022 at 2:09PM (UTC)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant