清除iOS 6< input type = file>图像缩略图 [英] Clear iOS 6 <input type=file> image thumbnail

查看:167
本文介绍了清除iOS 6< input type = file>图像缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从iOS 6开始,可以使用< input type ='file'> 来访问照片库。我使用它通过UIWebView将图像上传到墙上。工作正常。

Since iOS 6 it is possible to use the <input type='file'> to access the photo library. I use this to upload images to a wall, through an UIWebView. Works fine.

Apple很好地实现了输入元素,在按钮和文件名字段之间有一个小的自动生成的缩略图。

The input element is kinda nicely implemented by Apple, with a small auto-generated thumbnail between the button and the filename field.

我唯一的问题是我似乎无法重置此缩略图。如果它将输入的 .value 设置为null,则文件名清除(无文件选择,如最初所述)但缩略图仍然存在。同样的事情,如果我尝试 .reset()封装输入的html表单。小图片不会消失!

My only problem around this is that I cannot seem to reset this thumbnail. If it set the .value of the input to null, the filename clears out ("no file selected", as stated initially) but the thumbnail remains. Same thing if I try to .reset() the html form encapsulating the input. The small image won't go away!

任何人都知道如何实现这个目标吗?

Anyone know how to achieve this?

推荐答案

我可以在包含表单上重置工作。我只是使用附加的webkit检查器在我的设备上进行了一个简单的测试。

I am able to have reset work on the containing form. I just did a simple test on my device using webkit inspector attached to it.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>upload</title>
    <style>
    html, body {
        width: 300px;
    }
    </style>
</head>
<body>

<form id="con">
<input id="tgt" type="file" />
</form>

</body>
</html>

我使用上面的简单html,然后检查器中的以下javascript:

I used the simple html above, then the following javascript in the inspector:

var con = document.getElementById('con');
con.reset();

使用它删除了我的缩略图。我在这里添加了一个带内联代码的示例:
http://www.mixicon。 com / downloads / input.html

Using that removed the thumbnail image for me. I've included an example with inline code here: http://www.mixicon.com/downloads/input.html

这篇关于清除iOS 6&lt; input type = file&gt;图像缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆