<?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: Ajax form upload local image file without refresh</title>
	<atom:link href="http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 27 Nov 2011 21:08:44 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: [alfa]</title>
		<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/comment-page-1/#comment-8203</link>
		<dc:creator>[alfa]</dc:creator>
		<pubDate>Sat, 09 Apr 2011 11:15:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.fengcool.com/?p=83#comment-8203</guid>
		<description>Thank you very much rick...It works perfectly! 
Now your code is complete.</description>
		<content:encoded><![CDATA[<p>Thank you very much rick&#8230;It works perfectly!<br />
Now your code is complete.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rick</title>
		<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/comment-page-1/#comment-8194</link>
		<dc:creator>rick</dc:creator>
		<pubDate>Fri, 08 Apr 2011 17:50:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.fengcool.com/?p=83#comment-8194</guid>
		<description>Hi alfa, 

You can make an extra ajax call to remove the file from server.
This is an example. I have tested, hope this can help you.

function removeUpload(e){
   var removeId = $(e.target).attr(&#039;alt&#039;);
   // get image src path
   var imagePath =  $(&#039;#&#039;+removeId).find(&#039;img&#039;).attr(&#039;src&#039;);

   $(&#039;#&#039;+removeId).remove();
   if(fileCount&gt;0) fileCount--;
   $(&quot;#inp&quot;).removeAttr(&#039;disabled&#039;);
  
   // send image src to server
  $.get( &quot;http://your_domain/your_file.php&quot; , {&#039;removeFileName&#039;:imagePath}  );
}</description>
		<content:encoded><![CDATA[<p>Hi alfa, </p>
<p>You can make an extra ajax call to remove the file from server.<br />
This is an example. I have tested, hope this can help you.</p>
<p>function removeUpload(e){<br />
   var removeId = $(e.target).attr(&#8217;alt&#8217;);<br />
   // get image src path<br />
   var imagePath =  $(&#8217;#'+removeId).find(&#8217;img&#8217;).attr(&#8217;src&#8217;);</p>
<p>   $(&#8217;#'+removeId).remove();<br />
   if(fileCount&gt;0) fileCount&#8211;;<br />
   $(&#8221;#inp&#8221;).removeAttr(&#8217;disabled&#8217;);</p>
<p>   // send image src to server<br />
  $.get( &#8220;http://your_domain/your_file.php&#8221; , {&#8217;removeFileName&#8217;:imagePath}  );<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: [alfa]</title>
		<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/comment-page-1/#comment-8191</link>
		<dc:creator>[alfa]</dc:creator>
		<pubDate>Fri, 08 Apr 2011 08:38:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.fengcool.com/?p=83#comment-8191</guid>
		<description>How to add another ajax call within function removeUpload(e){} to remove image from server?</description>
		<content:encoded><![CDATA[<p>How to add another ajax call within function removeUpload(e){} to remove image from server?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ruben Sargsyan</title>
		<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/comment-page-1/#comment-7500</link>
		<dc:creator>Ruben Sargsyan</dc:creator>
		<pubDate>Wed, 09 Feb 2011 07:36:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.fengcool.com/?p=83#comment-7500</guid>
		<description>Have you tried to change the line

if(response.indexOf(&#039;.gif&#039;)!=-1){ //upload successfully

to

if(response.indexOf(&#039;.gif&#039;)!=-1 &#124;&#124; response.indexOf(&#039;.jpg&#039;)!=-1 &#124;&#124; response.indexOf(&#039;.jpeg&#039;)!=-1 &#124;&#124; response.indexOf(&#039;.png&#039;)!=-1){ //upload successfully</description>
		<content:encoded><![CDATA[<p>Have you tried to change the line</p>
<p>if(response.indexOf(&#8217;.gif&#8217;)!=-1){ //upload successfully</p>
<p>to</p>
<p>if(response.indexOf(&#8217;.gif&#8217;)!=-1 || response.indexOf(&#8217;.jpg&#8217;)!=-1 || response.indexOf(&#8217;.jpeg&#8217;)!=-1 || response.indexOf(&#8217;.png&#8217;)!=-1){ //upload successfully</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc</title>
		<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/comment-page-1/#comment-7441</link>
		<dc:creator>Marc</dc:creator>
		<pubDate>Fri, 04 Feb 2011 17:51:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.fengcool.com/?p=83#comment-7441</guid>
		<description>if(response.indexOf(&#039;.gif&#039;)!=-1){ //upload successfully

How to make it accept multipe (jpg, jpeg, gif &amp; png), already did it on save.php but need to know how to do it on ajax side.</description>
		<content:encoded><![CDATA[<p>if(response.indexOf(&#8217;.gif&#8217;)!=-1){ //upload successfully</p>
<p>How to make it accept multipe (jpg, jpeg, gif &amp; png), already did it on save.php but need to know how to do it on ajax side.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MODx Jot image upload using ajax - Question Lounge</title>
		<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/comment-page-1/#comment-7125</link>
		<dc:creator>MODx Jot image upload using ajax - Question Lounge</dc:creator>
		<pubDate>Fri, 07 Jan 2011 02:11:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.fengcool.com/?p=83#comment-7125</guid>
		<description>[...] getting a image upload field to work so people can upload a pic of the fish. I&#8217;m using this http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/ and i can get the image to upload but not show up in the jot-comment section. So i need the [...]</description>
		<content:encoded><![CDATA[<p>[...] getting a image upload field to work so people can upload a pic of the fish. I&#8217;m using this <a href="http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/" rel="nofollow">http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/</a> and i can get the image to upload but not show up in the jot-comment section. So i need the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anotherbeginner</title>
		<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/comment-page-1/#comment-6503</link>
		<dc:creator>anotherbeginner</dc:creator>
		<pubDate>Fri, 12 Nov 2010 18:08:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.fengcool.com/?p=83#comment-6503</guid>
		<description>i have a problem only with firefox 3.6, 3.5 (both on windows and ubuntu) but not with firefox 4 beta or firefox 2.0, when i try to generate unique image name in save.php 
$_FILES[&#039;image&#039;][&#039;name&#039;] = mt_rand(222,999).&#039;.jpg&#039;;
$uploadfile = $_FILES[&#039;image&#039;][&#039;name&#039;];

the first uploaded image is generated as normal, but the second is generated two times, and the third is generated three times, so after 3 uploads i see 3 images in browser, but on server i have 6 images (1+2+3). is there a way to correct this?</description>
		<content:encoded><![CDATA[<p>i have a problem only with firefox 3.6, 3.5 (both on windows and ubuntu) but not with firefox 4 beta or firefox 2.0, when i try to generate unique image name in save.php<br />
$_FILES['image']['name'] = mt_rand(222,999).&#8217;.jpg&#8217;;<br />
$uploadfile = $_FILES['image']['name'];</p>
<p>the first uploaded image is generated as normal, but the second is generated two times, and the third is generated three times, so after 3 uploads i see 3 images in browser, but on server i have 6 images (1+2+3). is there a way to correct this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jquerybeginner</title>
		<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/comment-page-1/#comment-6101</link>
		<dc:creator>jquerybeginner</dc:creator>
		<pubDate>Sat, 11 Sep 2010 03:39:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.fengcool.com/?p=83#comment-6101</guid>
		<description>What a neat and clear explanation! I went through so many websites in search of what I was looking for: to upload files to the database, but none explained to me so clearly what they were doing or why. Now I understand what they all have been doing. Thanks to you!</description>
		<content:encoded><![CDATA[<p>What a neat and clear explanation! I went through so many websites in search of what I was looking for: to upload files to the database, but none explained to me so clearly what they were doing or why. Now I understand what they all have been doing. Thanks to you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: passing variables between function in jQuery &#124; The Largest Forum Archive</title>
		<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/comment-page-1/#comment-5997</link>
		<dc:creator>passing variables between function in jQuery &#124; The Largest Forum Archive</dc:creator>
		<pubDate>Sat, 31 Jul 2010 14:25:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.fengcool.com/?p=83#comment-5997</guid>
		<description>[...] http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/ [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/" rel="nofollow">http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AdRock</title>
		<link>http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/comment-page-1/#comment-5992</link>
		<dc:creator>AdRock</dc:creator>
		<pubDate>Thu, 29 Jul 2010 15:27:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.fengcool.com/?p=83#comment-5992</guid>
		<description>This is exactly what I&#039;ve been looking for.

All the other examples I&#039;ve seen uses a form action button to the upload/save.php where in fact I want to have my own action.  Your example lets me do what i want so i can save data in a database.

Excellent work and thanks for sharing</description>
		<content:encoded><![CDATA[<p>This is exactly what I&#8217;ve been looking for.</p>
<p>All the other examples I&#8217;ve seen uses a form action button to the upload/save.php where in fact I want to have my own action.  Your example lets me do what i want so i can save data in a database.</p>
<p>Excellent work and thanks for sharing</p>
]]></content:encoded>
	</item>
</channel>
</rss>

