Q
Q
q1we2016-01-12 19:15:56
HTML
q1we, 2016-01-12 19:15:56

Is it acceptable to upload, send in the form of a file along with the text?

There is a web page with fillable fields, the data from which is sent to the server after clicking on the button. You need to add the ability to send files. It is desirable that everything is sent at once after one click. What is the best way to do this? Would the following code work:

<form id="TextOfArticle" method="post" action="SaveArticleInfo" enctype="multipart/form-data">
            <textarea name="Title">Заглавие</textarea>
            <textarea name="Text">Текст</textarea>
            <textarea name="Comment">Текст комментария</textarea>
            <input type="file" name="uploadedimage" accept="image/jpeg"/>
            <button type="submit" form="TextOfArticle" href="#bottom" >Send article</button>
        </form>

They write that when sending files, you need to specify enctype="multipart/form-data" in the form properties . Will this setting affect the data in the text fields (Title, Text)? I know that the default enctype value is application/x-www-form-urlencoded
The above code works, but is there a better or better way to send the file?
p.s. I'm using ASP.NET MVC.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kovalsky, 2016-01-12
@dmitryKovalskiy

You can do this, you can use scripts differently. When you are programming the cloud file storage web interface, you will think about other approaches. If you want to learn different methods of downloading files - google and study materials, do tests. Well, if you need to send a file to the server for a specific task, you have completed this task. If you are studying - I offer you another task. Send an unknown number of files to the server with one click of a button.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question