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

How to make the upload conditional ? #234

Open
sbdm05 opened this issue Jun 6, 2018 · 0 comments
Open

How to make the upload conditional ? #234

sbdm05 opened this issue Jun 6, 2018 · 0 comments

Comments

@sbdm05
Copy link

sbdm05 commented Jun 6, 2018

Hello,
I have a form with multiple fields: how can I validate the form even without a image ? Right now, it throws "not a file", and the form is not saved unless I add an image (even if I edit the form).

  handleSubmit(e, props) {
    e.preventDefault();
upload.send(document.getElementById("uploadFile").files[0], function(
      error,
      downloadUrl
    ) {
      uploader.set();


      if (error) {
        alert(error);
      } else {
      console.log("Success!");
      console.log("uploaded file available here: " + downloadUrl);

      Meteor.call(
        "laws.update",
        lawId,
        titleLoi,
        abstractLoi,
        downloadUrl
      );
      }
      uploader.set(upload);
    });
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

No branches or pull requests

1 participant