4

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.

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

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?

2
  • 3
    Seems like someone should file a bug report.
    – Thilo
    Sep 28, 2012 at 9:35
  • Well, yeah. Maybe that is the case, that this isn't thought of by Apple.
    – stafffan
    Oct 1, 2012 at 5:29

1 Answer 1

2

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>

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

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

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

2
  • As an aside, I used iOS 6.1.1 (10B145) to test this. appVersion: "5.0 (iPhone; CPU iPhone OS 6_1_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B145 Safari/8536.25"
    – whoughton
    Feb 15, 2013 at 18:14
  • Suppose they've fixed this issue by now. Thanks for noticing me!
    – stafffan
    May 28, 2013 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.