简体   繁体   中英

HTML input type file with android 4.4

Input type file doesn't work with android 4.4 (kitkat).

Is there a way to use form submit with input type="file" with phonegap in android 4.4. My form looks like:

<form id="testFrm" method="POST" enctype="multipart/form-data" >
    <input type="text" id="sub" name="subject" placeholder="Subject" />
    <input type="text" id="desc" name="desc" placeholder="Description" />
    <input type="file" name="file" id="file" />
    <input type="submit" />
</form>

I'm on cordova 2.8

Seems you want to use the PhoneGap FileTransfer method which according to the docs "The FileTransfer object allows you to upload or download files to and from a server." which is exactly what you need. There is a code example there that should get you started.

UPDATE (by request from your comment):

One form is not really designed to "include" another form however any of the fields that are included inside the "form" tag will be transmitted with the submit to the server (in the form of "Name1=value1&Name2=value2&",etc) so instead of having two forms you can just have multiple fields under one form tag.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM