Search code examples
androidcodeigniterfile-uploadformsimage-capture

Upload Picture Form Fails On Mobile Chrome


I'm building a mobile webapp, in which pictures from the user's phone play a significant part.

I've got this form, in which a user can upload a picture taken from his mobile phone into the app's DB. I'm using CodeIgniter's upload class in order to do the actual uploading.

<form enctype="multipart/form-data" action="myapp/do_upload" method="post" accept-charset="utf-8">
            <input type="file" accept="image/*" capture="camera" name="userfile"></input>
            <input type="submit" value="Submit" class="btn btn-block"></button>
    </form>

PROBLEM:

The app works great on my desktop computer: You choose a file, it uploads it, and throws an error if it doesn't work.

However, when trying to do the same thing on my mobile phone (Android running Mobile Chrome), the submit button refuses to work.

I've tried fiddling with the attributes - no success.

Any Idea what's stopping the form from actually working?


Solution

  • You Problem is here

    <form enctype="multipart/form-data" action="myapp/do_upload" method="post" accept-charset="utf-8">
                <input type="file" accept="image/*" capture="camera" name="userfile"></input>
                <input type="submit" value="Submit" class="btn btn-block"></button> //wrong
                <button type="submit" value="Submit" class="btn btn-block"></button> //right
        </form>