<?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: YUI Connect asynchronous file uploads</title>
	<atom:link href="http://www.designdisclosure.com/2009/11/yui-connect-asynchronous-file-uploads/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.designdisclosure.com/2009/11/yui-connect-asynchronous-file-uploads/</link>
	<description>Developing web and iphone applications for fun, profit or distraction</description>
	<lastBuildDate>Mon, 12 Apr 2010 00:35:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Alistair Stead</title>
		<link>http://www.designdisclosure.com/2009/11/yui-connect-asynchronous-file-uploads/#comment-1312</link>
		<dc:creator>Alistair Stead</dc:creator>
		<pubDate>Mon, 30 Nov 2009 14:19:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.designdisclosure.com/?p=122#comment-1312</guid>
		<description>Hi Alejo,

I&#039;m not too sure from the code you have provided what it is you are trying to do but I think I can possibly provide some insight?

When you submit multi-part data the form is not submitted as an XML-HTTP request but rather it is submitted to a hidden iFrame as a standard HTTP request. If you are attempting to change your view and response based the type of request it will not function as expected when submitting files. If you are then trying to parse your responseText as JSON this will likely lead to problems. Unless you have a specific requirement to return JSON I normally return a simple HTML response and use innerHTML to place it in the page to show errors and success message.

If you would like me to look further please post the code online and I will happily take a look for you.

Alistair</description>
		<content:encoded><![CDATA[<p>Hi Alejo,</p>
<p>I&#8217;m not too sure from the code you have provided what it is you are trying to do but I think I can possibly provide some insight?</p>
<p>When you submit multi-part data the form is not submitted as an XML-HTTP request but rather it is submitted to a hidden iFrame as a standard HTTP request. If you are attempting to change your view and response based the type of request it will not function as expected when submitting files. If you are then trying to parse your responseText as JSON this will likely lead to problems. Unless you have a specific requirement to return JSON I normally return a simple HTML response and use innerHTML to place it in the page to show errors and success message.</p>
<p>If you would like me to look further please post the code online and I will happily take a look for you.</p>
<p>Alistair</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alejo</title>
		<link>http://www.designdisclosure.com/2009/11/yui-connect-asynchronous-file-uploads/#comment-1310</link>
		<dc:creator>alejo</dc:creator>
		<pubDate>Mon, 30 Nov 2009 07:04:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.designdisclosure.com/?p=122#comment-1310</guid>
		<description>thanks for charing this info, really kool !!!!!..

i just have a question, when the yui send the request for upload files, in the server side
i can&#039;t use this:
//php code
ob_start();
require(VIEWS.&#039;someFile.php&#039;);
echo json_encode(ob_get_clean());
//in the client side just
var response = YAHOO.lang.JSON.parse(o.responseText);

this work good with the other&#039;s request like $_GET or $_POST, but
when i try use that for uploading files, the javascript said:
illegal character with native eval(&#039;(&#039;+o.responseTex+&#039;)&#039;)
and using yui said &quot;SyntaxError&quot;,

So i google the solution like for two day and nothing, so my solution
was returned one little json object like:
$response = array(&#039;type&#039;=&gt;&#039;ERR_VALID&#039;, &#039;errors&#039;=&gt;$valid[&#039;errors&#039;]);
echo json_encode($response);

And in the client side write a lot off javascript.

If you know how parse the entire view in this kind off request,
i would be very grateful
thanks.</description>
		<content:encoded><![CDATA[<p>thanks for charing this info, really kool !!!!!..</p>
<p>i just have a question, when the yui send the request for upload files, in the server side<br />
i can&#8217;t use this:<br />
//php code<br />
ob_start();<br />
require(VIEWS.&#8217;someFile.php&#8217;);<br />
echo json_encode(ob_get_clean());<br />
//in the client side just<br />
var response = YAHOO.lang.JSON.parse(o.responseText);</p>
<p>this work good with the other&#8217;s request like $_GET or $_POST, but<br />
when i try use that for uploading files, the javascript said:<br />
illegal character with native eval(&#8216;(&#8216;+o.responseTex+&#8217;)')<br />
and using yui said &#8220;SyntaxError&#8221;,</p>
<p>So i google the solution like for two day and nothing, so my solution<br />
was returned one little json object like:<br />
$response = array(&#8216;type&#8217;=&gt;&#8217;ERR_VALID&#8217;, &#8216;errors&#8217;=&gt;$valid['errors']);<br />
echo json_encode($response);</p>
<p>And in the client side write a lot off javascript.</p>
<p>If you know how parse the entire view in this kind off request,<br />
i would be very grateful<br />
thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
