EZ Forms - Attach file to email

I’m trying to attach a resume pdf to an email that sends to our client when a user submits a careers form on their website. I’m using the EZ Forms plugin with Sendinblue as the provider. Any direction on how to accomplish this would be wonderful. I’ve tried altering the EZ Forms plugin and just directly using Sendinblue’s API, but to no avail.

Here is my form component.

const FormTwo = () => {
	const [fName, setFName] = useState('')
	const [lName, setLName] = useState('')
	const [email, setEmail] = useState('')
	const [phone, setPhone] = useState('')
	const [resume, setResume] = useState('')
	const [message, setMessage] = useState('')
	const [submitted, setSubmitted] = useState(false)
	const [bot, setBot] = useState(true)
	const submitFormTwo = async () => {
		let form = {
			"Submission Info": "<br /><br />",
			"First Name": `${fName}<br \/>`,
			"Last Name": `${lName}<br \/>`,
			"Email": `${email}<br \/>`,
			"Phone": `${phone}<br \/>`,
			"Message": `${message}<br \/>`
		}
		fetch(`${URL}/ezforms/submit`, {
			method: 'POST',
			headers: {
				'Content-Type': 'application/json',
			},
			body: JSON.stringify({ formData: form, formName: 'Careers Form' }),
			formData: form,
		})
			.then((response) => response.json())
			.then((data) => console.log(data))
		setSubmitted(true)
	}
	if (submitted) {
		return (
			<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
				<h3>Thank you! We'll be in touch shortly.</h3>
			</div>
		)
	}
	return (
		<form onSubmit={submitFormTwo} method='POST'>
			<div className={styles.formLeft}>
				<input type='text' name='fName' placeholder='First Name' onChange={(e) => setFName(e.target.value)} required />
				<input type='email' name='email' placeholder='Email' onChange={(e) => setEmail(e.target.value)} required />
				<textarea placeholder='Message/Explanation (optional)' onChange={(e) => setMessage(e.target.value)}></textarea>
			</div>
			<div className={styles.formRight}>
				<input type='text' name='lName' placeholder='Last Name' onChange={(e) => setLName(e.target.value)} required />
				<input type='tel' name='phone' placeholder='Phone' onChange={(e) => setPhone(e.target.value)} required />
				<input className={styles.fileUplaod} type={'file'} name='resume' onChange={(e) => setResume(e.target.files[0])} required />
				<Captcha sitekey={process.env.V_TWO_SITE_KEY} onChange={() => setBot(!bot)} />
				<button className={styles.btn2} type='submit' disabled={bot}>
					Submit
				</button>
			</div>
		</form>
	)
}
1 Like

Hi @ryanwspears! Did you manage to upload file with ezforms? have the same issue(

@Nikita_Zholkovskyi I wish. I couldn’t find any information on how or if it could be done. I ended up just creating a form on JotForm and embedding it into my page. I’ve also been having trouble with errors when sending my form. It seems that if I use ReCaptcha v3 as a captcha provider, it doesn’t want to send any of the data from the form. Also, ever since I started using this plugin, I always get a 500 error. Even though the form will submit and the email sends out, there’s always a 500 error and I’m not sure what’s going wrong. It would seem as if EZ Forms just has some bugs that they need to fix for this plugin to be worth using. Sorry I couldn’t be any help, my guy.