R
R
Roman Rakzin2016-09-22 21:44:26
go
Roman Rakzin, 2016-09-22 21:44:26

How to find out the number of attached files in go?

I submit a form to the server to which I attach image files.
Initially, the number of pictures is not known.
The form looks like this
If the user has added several photos, it will

<input type="file" name="file_1">  
    <input type="file" name="file_2">

I'm taking data from a single file so `file, _, err := r.FormFile("file_1")`
how do I get the number of files in go and iterate over each one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
evnuh, 2016-09-22
@TwoRS

You don’t need to do this, you need to do multipart and set the multiple attribute to the input with files
sanatgersappa.blogspot.ru/2013/03/handling-multipl...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question