简体   繁体   English

带有Android 4.4的HTML输入类型文件

[英]HTML input type file with android 4.4

Input type file doesn't work with android 4.4 (kitkat). 输入类型文件不适用于android 4.4(kitkat)。

Is there a way to use form submit with input type="file" with phonegap in android 4.4. 有没有一种方法可以在Android 4.4中将带有输入type =“ file”的表单提交与phonegap一起使用。 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 我在科尔多瓦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." 似乎您想使用PhoneGap FileTransfer方法,该方法根据docs“ FileTransfer对象允许您向服务器上载文件或从服务器上下载文件”。 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. 一个表单并不是真正设计为“包含”另一种表单,但是“ form”标记中包含的任何字段都将随提交一起传输到服务器(以“ Name1 = value1&Name2 = value2&”的形式,等等)因此,除了拥有两个表单之外,您还可以在一个form标签下拥有多个字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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