Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selecting a file to upload causes mobile Safari to crash

I've been experiencing behaviour on, at least my iPhone 6 Plus, when using the <input type="file"> to let the user upload an image.

<div class="add__from-camera">      <button class="add__from-camera__btn">          <i class="fa fa-fw fa-camera"></i> Add with Camera      </button>      <input class="add__from-camera__input" type="file">  </div>

This rest case results in crashes of the tab about 50% of the time, and in my app about 90% of the time.

I was 'lucky' enough to get all of Safari to crash once when the error happened, and this was part of the log:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x00030000006467ba Triggered by Thread:  0  Thread 0 name:  Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0   WebKit                          0x000000018a48566c WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon(WTF::Vector<WTF::String, 0ul, WTF::CrashOnOverflow> const&, WTF::String const&, API::Data const*) + 44 1   WebKit                          0x000000018a461648 WebKit::WebOpenPanelResultListenerProxy::chooseFiles(API::Array*, API::String*, API::Data const*) + 100 2   WebKit                          0x000000018a461648 WebKit::WebOpenPanelResultListenerProxy::chooseFiles(API::Array*, API::String*, API::Data const*) + 100 3   WebKit                          0x000000018a413020 -[WKFileUploadPanel _chooseFiles:displayString:iconImage:] + 468 

It seems to indicate an (overflow?) error in display the little thumbnail preview? Is there a way to prevent Safari from crashing when using file input, or at least don't render the thumbnail preview?

like image 779
Josh Hunt Avatar asked Nov 16 '14 08:11

Josh Hunt


People also ask

Why does my phone keep crashing on safari?

Clear Out History & Web Data in Safari Safari accumulates caches, browsing history, cookies, and other data in the iPhone or iPad. Sometimes that data can interfere with app functionality, so clearing it out can be a remedy to problems with the app crashing or stalling on some web sites.

How do I stop Safari from crashing on my iPhone?

The best ways to fix Safari Crashing on iPhone problem are, to restart your iPhone, update the latest iOS, Clear Safari History, and Website Data, Turn off Java Script Option, and Disable iCloud and Safari Syncing.


1 Answers

Try this:

<input class="add__from-camera__input" type="file" accept="image/*;capture=camera"> 
like image 104
TheXReflex Avatar answered Sep 27 '22 19:09

TheXReflex