-1

I need to submit form which contains two inputs:

<form action="upload" method="post" accept-charset="utf-8" enctype="multipart/form-data" 

    id="upload">
            <textarea name="file_description"></textarea><br/>
            <input type="file" name="userfile" id="userfile" /><br/>
            <input type="submit" name="upload_button" value="upload"/>
</form>

This question maybe duplicate of this, but I tried and get errors. Can anyone guide me with submitting form which contains file and other inputs?

Community
  • 1
  • 1
torayeff
  • 37
  • 1
  • 8

1 Answers1

0

You can use XHR2 and FileAPI. It's new HTML5 API with pretty good browser support by now. XHR2 allows you to send files via AJAX and FileAPI is used to get file content from input[type=file]

There are plenty articles on that subject in the web. For example: Processing XHR2 file uploads in PHP

Artem Sobolev
  • 5,891
  • 1
  • 22
  • 40