MM6th
June 11, 2022, 5:17am
1
I currently am facing an obstacle when uploading files to netlify. Not only are my inputs not registering, but only one file will upload. When selecting multiple files none will upload. Below is my code:
UPLOAD THE CONTENT IN QUESTION TO GET POSTED
OR
Blur my face
Sector
Music Cover
Other
<label for="file">Choose a file:</label><br>
<input type="file" name="music" multiple="multiple"/><br><br>
<input type="submit" value="SUBMIT">
</form>
</div>
</div>
</div>
</div>
Hey @MM6th
As per the File Uploads documentation
Only one file upload per field is supported. For multiple file uploads, use multiple fields.
MM6th
June 11, 2022, 5:36am
3
Hi.
I don’t understand. Isn’t every input a field? That would mean I have multiple fields no?
Using multiple
means multiple files in a single field . You need multiple fields each handling a single file.
I.E.
Three separate file fields each with a single file
<input type="file" name="file1">
<input type="file" name="file2">
<input type="file" name="file3">
and not
one file field allowing more than one file.
<input type="file" name="files" multiple>
MM6th
June 11, 2022, 5:54am
5
Ok. I replaced the prior code with what you suggested, and it didn’t register. None of the files submitted
It wasn’t intended for verbatim copy/paste, rather a demonstration.
If you can share the page the form is on, and the repository you are deploying from, I can possible offer more pertinent assistance.
HTML isn’t code.
MM6th
June 11, 2022, 6:15am
7
Ok. I deploy from Netlify alone.
ecstatic-euclid-0fb5be
Using the form from the Netlify Documentation I added a form field
<form name="fileForm" enctype="multipart/form-data" data-netlify="true">
<p>
<label>
<span>Name:</span>
<input name="name" type="text"/>
</label>
</p>
<p>
<label>
<span>Add file:</span>
<input name="file1" type="file"/>
</label>
</p>
<p>
<label>
<span>Add file:</span>
<input name="file2" type="file"/>
</label>
</p>
<button>Submit</button>
</form>
And see both images are submitted:
1 Like
MM6th
June 11, 2022, 3:30pm
9
This truly worked. I want to thank you for your patience with me, and expertise.