<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: iCab Mobile/UIWebView and implementing support for file uploads</title>
	<atom:link href="http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/</link>
	<description>iCab related stuff; Mac, iPhone and Cocoa programming</description>
	<lastBuildDate>Mon, 17 Jun 2013 14:36:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Sascha</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-48930</link>
		<dc:creator>Sascha</dc:creator>
		<pubDate>Wed, 05 Dec 2012 21:51:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-48930</guid>
		<description><![CDATA[I´ve send the files via email]]></description>
		<content:encoded><![CDATA[<p>I´ve send the files via email</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-48844</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Wed, 05 Dec 2012 13:51:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-48844</guid>
		<description><![CDATA[@Sascha
Yes, just send it to alexander@icab.de]]></description>
		<content:encoded><![CDATA[<p>@Sascha<br />
Yes, just send it to <a href="mailto:alexander@icab.de">alexander@icab.de</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sascha</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-48787</link>
		<dc:creator>Sascha</dc:creator>
		<pubDate>Wed, 05 Dec 2012 08:01:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-48787</guid>
		<description><![CDATA[Is it possible, to send you both files (form and upload.php) for example via email or something else?]]></description>
		<content:encoded><![CDATA[<p>Is it possible, to send you both files (form and upload.php) for example via email or something else?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-48686</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Tue, 04 Dec 2012 23:59:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-48686</guid>
		<description><![CDATA[@Sascha
What do you mean by the &quot;iPad Upload folder&quot;? And how exactly does your form look like?]]></description>
		<content:encoded><![CDATA[<p>@Sascha<br />
What do you mean by the &#8220;iPad Upload folder&#8221;? And how exactly does your form look like?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sascha</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-48661</link>
		<dc:creator>Sascha</dc:creator>
		<pubDate>Tue, 04 Dec 2012 21:28:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-48661</guid>
		<description><![CDATA[Hier noch einmal die PHP-Datei:
&quot;&lt;?php
f (isset($_FILES[&quot;datei&quot;])) {

$_FILES[&quot;datei&quot;][&quot;size&quot;] &quot;]]></description>
		<content:encoded><![CDATA[<p>Hier noch einmal die PHP-Datei:<br />
&#8220;&lt;?php<br />
f (isset($_FILES[&quot;datei&quot;])) {</p>
<p>$_FILES[&quot;datei&quot;][&quot;size&quot;] &#8220;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sascha</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-48658</link>
		<dc:creator>Sascha</dc:creator>
		<pubDate>Tue, 04 Dec 2012 21:19:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-48658</guid>
		<description><![CDATA[Because the default runalyze doesen´t work, I tried to create a workaround for me. So I createted a form (copied from www.selfphp.info with the folowing code:


  Datei:
  
  
  


To move the file to an upload folder, I created the folowing script (upload.php):



But after all, where is no file within the ipad/upload folder and I don´t know, what I´m doing wrong.]]></description>
		<content:encoded><![CDATA[<p>Because the default runalyze doesen´t work, I tried to create a workaround for me. So I createted a form (copied from <a href="http://www.selfphp.info" rel="nofollow">http://www.selfphp.info</a> with the folowing code:</p>
<p>  Datei:</p>
<p>To move the file to an upload folder, I created the folowing script (upload.php):</p>
<p>But after all, where is no file within the ipad/upload folder and I don´t know, what I´m doing wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-48615</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Tue, 04 Dec 2012 18:13:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-48615</guid>
		<description><![CDATA[@Sascha
What exactly are you trying to do? The upload forms of the Runalyze size isn&#039;t really compatible to the iOS. This is one of the sites which seems to use the file reader API which is not working on the iOS. And often the &quot;upload&quot; buttons would only shown on &quot;mouse hover&quot; events (move the ouse over a certain arteas without clicking), which are impossible to create on a touch screen (you have to click to trigger an action). There are also some other sthings this page is doing which is not really working well on a mobile device.]]></description>
		<content:encoded><![CDATA[<p>@Sascha<br />
What exactly are you trying to do? The upload forms of the Runalyze size isn&#8217;t really compatible to the iOS. This is one of the sites which seems to use the file reader API which is not working on the iOS. And often the &#8220;upload&#8221; buttons would only shown on &#8220;mouse hover&#8221; events (move the ouse over a certain arteas without clicking), which are impossible to create on a touch screen (you have to click to trigger an action). There are also some other sthings this page is doing which is not really working well on a mobile device.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sascha</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-48575</link>
		<dc:creator>Sascha</dc:creator>
		<pubDate>Tue, 04 Dec 2012 15:20:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-48575</guid>
		<description><![CDATA[I don&#039;t know, what I&#039;m doing wring. If I use your code, I&#039;m not able to find the file, I tried to upload. I also copied some examples, I found by google, but nothing seems to work. What is my fault?

My target is to run a local instance of runalyze, withc can bei downloaded at www. Runalyze.de]]></description>
		<content:encoded><![CDATA[<p>I don&#8217;t know, what I&#8217;m doing wring. If I use your code, I&#8217;m not able to find the file, I tried to upload. I also copied some examples, I found by google, but nothing seems to work. What is my fault?</p>
<p>My target is to run a local instance of runalyze, withc can bei downloaded at www. Runalyze.de</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-48341</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Mon, 03 Dec 2012 23:51:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-48341</guid>
		<description><![CDATA[@Sascha
&quot;Real&quot; web sites where you can upload files are &lt;a href=&quot;http://www.flickr.com/&quot; rel=&quot;nofollow&quot;&gt;Flickr&lt;/a&gt; and &lt;a href=&quot;http://www.facebook.com&quot; rel=&quot;nofollow&quot;&gt;Facebook&lt;/a&gt; for example. When writing your own HTML code, a simple standard HTML form would work as well:

&lt;pre&gt;
&lt;form action=&quot;url&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
   &lt;input name=&quot;name&quot; type=&quot;file&quot;&gt;
   &lt;input value=&quot;Upload&quot; type=&quot;submit&quot;&gt;
&lt;/form&gt;
&lt;/pre&gt;

iCab also supports many of the more advanced JS tricks to make upload forms more comfortable to use (like for example on the Facebook page). But there are a few things which do not work because of limitations of the iOS (like the &quot;File reader&quot; API), so this should be avoided in your own HTML code when the form should work on the iOS platform as well.]]></description>
		<content:encoded><![CDATA[<p>@Sascha<br />
&#8220;Real&#8221; web sites where you can upload files are <a href="http://www.flickr.com/" rel="nofollow">Flickr</a> and <a href="http://www.facebook.com" rel="nofollow">Facebook</a> for example. When writing your own HTML code, a simple standard HTML form would work as well:</p>
<pre>
&lt;form action="url" method="post" enctype="multipart/form-data">
   &lt;input name="name" type="file">
   &lt;input value="Upload" type="submit">
&lt;/form>
</pre>
<p>iCab also supports many of the more advanced JS tricks to make upload forms more comfortable to use (like for example on the Facebook page). But there are a few things which do not work because of limitations of the iOS (like the &#8220;File reader&#8221; API), so this should be avoided in your own HTML code when the form should work on the iOS platform as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sascha</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-48307</link>
		<dc:creator>Sascha</dc:creator>
		<pubDate>Mon, 03 Dec 2012 21:20:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-48307</guid>
		<description><![CDATA[Is it possible, to provide a small example for fileuploads, that will work with icab mobile. I´ve a very small page, where I need a feature to upload a file to a special directory, but I´m not able to do this correctly, so that I can use the form from my ipad.]]></description>
		<content:encoded><![CDATA[<p>Is it possible, to provide a small example for fileuploads, that will work with icab mobile. I´ve a very small page, where I need a feature to upload a file to a special directory, but I´m not able to do this correctly, so that I can use the form from my ipad.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-41687</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Wed, 14 Nov 2012 13:53:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-41687</guid>
		<description><![CDATA[@Rahaman
I&#039;ll check this. The problem when you can only select from the photo album is a known issue. This happens when the web site creates the &quot;file select&quot; button on-the-fly after iCab has replaced the original file buttons. So this new buttons is unknown to iCab and therefore will be processed by the iOS itself. This is the reason for the proposal with the variable &quot;iCabMobile_FileFieldActive&quot; from the blog post, which can give icab a hint that it needs to search for new file buttons again.
]]></description>
		<content:encoded><![CDATA[<p>@Rahaman<br />
I&#8217;ll check this. The problem when you can only select from the photo album is a known issue. This happens when the web site creates the &#8220;file select&#8221; button on-the-fly after iCab has replaced the original file buttons. So this new buttons is unknown to iCab and therefore will be processed by the iOS itself. This is the reason for the proposal with the variable &#8220;iCabMobile_FileFieldActive&#8221; from the blog post, which can give icab a hint that it needs to search for new file buttons again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rahaman</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-41593</link>
		<dc:creator>Rahaman</dc:creator>
		<pubDate>Wed, 14 Nov 2012 03:31:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-41593</guid>
		<description><![CDATA[Hi Alexander,
I am particularly interested in this file upload feature &amp; while playing with a uploading site e.g. www.sendspace.com, I am encountering two issues regarding multiple file download

- For multiple file download, after I select 2 files, if I want to select 3rd file, it is not openning the &quot;Downloads&quot; folder to select my own file, rather it is only openning the default photo library
 - Even after 2 file selected, if I do submit, after submit, I can only get download link for the 1st file from the server, which means only 1st of the 2 files selected got uploaded successfully

Is this a known behavior? Can you please throw some light on this?]]></description>
		<content:encoded><![CDATA[<p>Hi Alexander,<br />
I am particularly interested in this file upload feature &amp; while playing with a uploading site e.g. <a href="http://www.sendspace.com" rel="nofollow">http://www.sendspace.com</a>, I am encountering two issues regarding multiple file download</p>
<p>- For multiple file download, after I select 2 files, if I want to select 3rd file, it is not openning the &#8220;Downloads&#8221; folder to select my own file, rather it is only openning the default photo library<br />
 &#8211; Even after 2 file selected, if I do submit, after submit, I can only get download link for the 1st file from the server, which means only 1st of the 2 files selected got uploaded successfully</p>
<p>Is this a known behavior? Can you please throw some light on this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-33392</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Sun, 19 Aug 2012 11:41:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-33392</guid>
		<description><![CDATA[@Ankit
Please read the header foe of the NSURLProtocol class, where you can see which methods you must implement.

 Basically the implementation of your own HTTP protocol handler is a global thing to your App, so it is completely independent of UIWebView. UIWebView will internally load all the data from the internet using the standard networking routines of Cocoa and all these are using NSURLProtocol to find and process the networking stuff. So you do not need to do anything within the UIWebView delegates or methods. Just install your own HTTP protocol handler and it will be automatically called.

I&#039;ll probably write a blog post about this topic soon. This is a little bit to big for the comments.]]></description>
		<content:encoded><![CDATA[<p>@Ankit<br />
Please read the header foe of the NSURLProtocol class, where you can see which methods you must implement.</p>
<p> Basically the implementation of your own HTTP protocol handler is a global thing to your App, so it is completely independent of UIWebView. UIWebView will internally load all the data from the internet using the standard networking routines of Cocoa and all these are using NSURLProtocol to find and process the networking stuff. So you do not need to do anything within the UIWebView delegates or methods. Just install your own HTTP protocol handler and it will be automatically called.</p>
<p>I&#8217;ll probably write a blog post about this topic soon. This is a little bit to big for the comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ankit</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-33383</link>
		<dc:creator>Ankit</dc:creator>
		<pubDate>Sun, 19 Aug 2012 05:02:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-33383</guid>
		<description><![CDATA[Thank you for your explanation. But Im still confusing that what methods that I need to implement? And where/when I actually modify the request? Right now, in the delegate method webView:shouldStartLoadWithRequest:navigationType: I have the code above, but seem like it doesn&#039;t work correctly. Please assist me with this matter. Really appreciated your help.]]></description>
		<content:encoded><![CDATA[<p>Thank you for your explanation. But Im still confusing that what methods that I need to implement? And where/when I actually modify the request? Right now, in the delegate method webView:shouldStartLoadWithRequest:navigationType: I have the code above, but seem like it doesn&#8217;t work correctly. Please assist me with this matter. Really appreciated your help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2012/08/02/uiwebview_file_upload_support/comment-page-1/#comment-33341</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Sat, 18 Aug 2012 11:36:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=268#comment-33341</guid>
		<description><![CDATA[@Ankit
Basically when implementing your own protocol handler, you just need to implement the required methods of the NSURLProtocol class. The header file of this class tells you which one are required. 

Your own protocol handler will be asked for all requests that are done via NSURLConnection if it will process this request. If it answers NO, then the standard handler will take over. You can even use NSURLConnections within your own handler to process the requests, but in this case your handler will be asked if it can process your own internal request as well, and to prevent a recursion you need to return NO here. Your internal requests needs to be processed by the standard HTTP protocol handler, but this is fine, because within your protocol handler you are able to modify or change the original request before sending it to the internet via your new internal NSURLConnection.

Using NSURLConnection within your protocol handler has the big advantage, that for almost all of the &quot;callback&quot; methods of the NSURLProtocol class there&#039;s a corresponding delegate of the NSURLConnection class. So most of the delegate methods of NSURLConnection just look similar to this one (the parameters of the delegate method are passed to the protocol handler object):
&lt;pre&gt;
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
	[[self client] URLProtocol:self didLoadData:data];
}
&lt;/pre&gt;

The only methods where you really need to do something more would be 
&lt;pre&gt;
- (void)startLoading
&lt;/pre&gt;

where you actually create a new connection for your (modified) request , and 

&lt;pre&gt;
- (void)stopLoading 
&lt;/pre&gt;

where you need to stop the connection, and

&lt;pre&gt;
+ (BOOL)canInitWithRequest:(NSURLRequest *)request
&lt;/pre&gt;

Where you have to decide if you want to take over this request (in case it&#039;s your form you need to modify), or if the standard handler needs to process it (it&#039;s another request or its one of your internal requests where you&#039;ve already modified the original requests).

According to your code: you should avoid using synchronous connections. Using the NSURLProtocol these are not needed.]]></description>
		<content:encoded><![CDATA[<p>@Ankit<br />
Basically when implementing your own protocol handler, you just need to implement the required methods of the NSURLProtocol class. The header file of this class tells you which one are required. </p>
<p>Your own protocol handler will be asked for all requests that are done via NSURLConnection if it will process this request. If it answers NO, then the standard handler will take over. You can even use NSURLConnections within your own handler to process the requests, but in this case your handler will be asked if it can process your own internal request as well, and to prevent a recursion you need to return NO here. Your internal requests needs to be processed by the standard HTTP protocol handler, but this is fine, because within your protocol handler you are able to modify or change the original request before sending it to the internet via your new internal NSURLConnection.</p>
<p>Using NSURLConnection within your protocol handler has the big advantage, that for almost all of the &#8220;callback&#8221; methods of the NSURLProtocol class there&#8217;s a corresponding delegate of the NSURLConnection class. So most of the delegate methods of NSURLConnection just look similar to this one (the parameters of the delegate method are passed to the protocol handler object):</p>
<pre>
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
	[[self client] URLProtocol:self didLoadData:data];
}
</pre>
<p>The only methods where you really need to do something more would be </p>
<pre>
- (void)startLoading
</pre>
<p>where you actually create a new connection for your (modified) request , and </p>
<pre>
- (void)stopLoading 
</pre>
<p>where you need to stop the connection, and</p>
<pre>
+ (BOOL)canInitWithRequest:(NSURLRequest *)request
</pre>
<p>Where you have to decide if you want to take over this request (in case it&#8217;s your form you need to modify), or if the standard handler needs to process it (it&#8217;s another request or its one of your internal requests where you&#8217;ve already modified the original requests).</p>
<p>According to your code: you should avoid using synchronous connections. Using the NSURLProtocol these are not needed.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
