2

We know that in iOS 6 mobile safari supports HTML input file tag to upload images. I just created an HTML file like this and it worked fine in mobile safari. But when I loaded it in a UIWebView, I found I could still tap the "Choose file" button to choose an image file, but after I tapped "done" and returned to the UIWebView, the web page in the UIWebView reloaded and no file was attached to the HTML form. Is that a restriction to UIWebView?

1
  • I dont think you can with a uiwebview. Commented Jun 25, 2013 at 16:46

1 Answer 1

6

I have sorted it out. This is due to I put the UIWebview loading web page function in "-viewWillAppear:(BOOL)animated". So each time when the "take photo" modal view hides, the UIWebview reloads the url. I have fixed it and I can confirm now that the HTML input file tag upload function works well in UIWebview, too.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you Steve, you saved my day!!!! That was exactly the issue, why my site always reloaded after choosing an image in WebView, but no where else. Thanks again.
how yo can fixed them?? @stevewang
I am from the future -- i wonder if this is the exact reason instagram's in-app browser reloads every time you try using an input tag for file uploads. my web app works EVERYWHERE in every webview except instagrams, after the file modal goes away, the page refreshes. I tested uploading a photo to facebook thru the instagram in-app browser and it refreshes, tried uploading a file on giphy and the page refreshes, etc etc.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.