Hello
I am able to receive everything from the form except the attachment that the user uploads.
My website:
My code:
<form class="b-contact-page__input" enctype="multipart/form-data" data-netlify="true" method="POST" name="quote" action="/#contact">
<div>
<input name="name" type="text" id="name" required placeholder="{{ .form_settings.name_placeholder }}">
</div>
<div>
<input name="email" type="email" id="email" required placeholder="{{ .form_settings.email_placeholder }}">
</div>
<div>
<input name="file" type="file" id="file">
</div>
<div>
<textarea class="data-hj-allow" name="message" id="message" rows="6" required placeholder="{{ .form_settings.message_placeholder }}"></textarea>
</div>
<button type="submit" onclick="location.href='#popup1'" class="b-contact-page__submit">{{ .form_settings.button_text }}</button>
</form>
I don’t think that your syntax is correct for netlify form.
Here is what I use according to their rules/syntax and it works flawlessly.
<form id="contact-form" name="{{.form_name}}" class="row gy-4" data-aos="zoom-out" method="POST" data-netlify="true" netlify-honeypot="surprise">
<div class="col-md-6">
<label for="name" class="form-label mb-1 text-dark" >{{ i18n "formname" }} :</label>
<input type="text" placeholder='{{ i18n "formname" }}' class="form-control shadow-none rounded-0 border-0" name="name" id="name" required>
</div>
<div class="form-group">
<label for="email" class="form-label mb-1 text-dark" >{{ i18n "formemail" }} :</label>
<input type="email" placeholder="{{ i18n "formemail" }}" class="form-control shadow-none rounded-0 border-0" name="email" id="email" required>
</div>
<div class="form-group">
<label for="subject" class="form-label mb-1 text-dark" >{{ i18n "formsubject" }} :</label>
<input type="text" placeholder="{{ i18n "formsubject" }}" class="form-control shadow-none rounded-0 border-0" name="subject" id="subject" required>
</div>
<div class="form-group">
<label for="message" class="form-label mb-1 text-dark" >{{ i18n "formmessage" }} :</label>
<textarea rows="6" placeholder="{{ i18n "formmessage" }}" class="form-control shadow-none rounded-0 border-0" name="message" id="message"></textarea>
</div>
<p class="hidden">
<label>"{{ i18n "human" }}"<input name="surprise" /></label>
</p>
<input type="hidden" id="type-www" name="type-www" value="{{.form_name}}" />
<input type="hidden" id="source-www" name="source-www" value="{{ site.Home.Permalink }}" />
<input type="hidden" id="page-www" name="page-www" value="{{ $.RelPermalink }}" />
<input type="hidden" id="language-www" name="language-www" value="{{ site.Language.LanguageName }}" />
<div id="submit">
<button type="submit" id="contact-submit" class="btn btn-primary" value="Send Message">{{ i18n "formsendmessage" }}</button>
</div>
</form>
4 Likes
I saw that you opend a post on Netlify forum
You didn’t change your code. Why don’t you try what I gave you as example ?