<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
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/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>AjaxMasters Blog &#187; ajax</title> <atom:link href="http://blog.ajaxmasters.com/tag/ajax/feed/" rel="self" type="application/rss+xml" /><link>http://blog.ajaxmasters.com</link> <description>Just another WordPress weblog</description> <lastBuildDate>Thu, 24 Jun 2010 11:55:25 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Ajax file upload with jQuery</title><link>http://blog.ajaxmasters.com/ajax-file-upload-with-jquery/</link> <comments>http://blog.ajaxmasters.com/ajax-file-upload-with-jquery/#comments</comments> <pubDate>Tue, 22 Sep 2009 22:25:44 +0000</pubDate> <dc:creator>Chocksy</dc:creator> <category><![CDATA[Tutorial]]></category> <category><![CDATA[ajax]]></category> <category><![CDATA[jquery]]></category><guid
isPermaLink="false">http://blog.ajaxmasters.com/?p=30</guid> <description><![CDATA[<a
href="http://blog.ajaxmasters.com/ajax-file-upload-with-jquery/"><img
align="left" hspace="5" width="150" height="150" src="http://blog.ajaxmasters.com/wp-content/uploads/2009/09/upload-pic-170x170.png" class="alignleft wp-post-image tfe" alt="JQUERY upload plugin" title="upload-pic" /></a>Sometimes we come into a problem that is a little harder to do when it comes to customizing and that is the file upload input. Well  Andris Valums helps us with a plugin he created for jQuery.
The plugin requires jQuery 1.2 or above and allows users to upload multiple files without refreshing the page.
To make the plugin work you have to include jQuery and the plugin in your websites [...]]]></description> <content:encoded><![CDATA[<div
id="attachment_33" class="wp-caption aligncenter" style="width: 510px"><a
href="http://blog.ajaxmasters.com/wp-content/uploads/2009/09/upload-pic.png"><img
src="http://blog.ajaxmasters.com/wp-content/uploads/2009/09/upload-pic.png" alt="JQUERY upload plugin" title="upload-pic" width="500" height="300" class="size-full wp-image-33" /></a><p
class="wp-caption-text">JQUERY upload plugin</p></div><p>Sometimes we come into a problem that is a little harder to do when it comes to customizing and that is the file upload input. Well <strong>Andris Valums</strong> helps us with a plugin he created for jQuery.</p><p>The plugin requires jQuery 1.2 or above and allows users to upload multiple files without refreshing the page.</p><p>To make the plugin work you have to include jQuery and the plugin in your websites head.</p><pre name="code" class="html">%MINIFYHTML936798cf3af9a5ef88a3eeabf614b4120%%MINIFYHTML936798cf3af9a5ef88a3eeabf614b4121%</pre><p>And after that you can add this for a div with a specific id:</p><pre class="brush: jscript;">
$(document).ready(function(){

$.ajax_upload('#div_id', {
  // Location of the server-side upload script
  action: 'upload.php',
  // File upload name
  name: 'userfile',
  // Additional data to send
  data: {
    key1 : 'value',
    key2 : 'value2'
  },
  // Fired when user selects file
  // You can return false to cancel upload
  onSubmit: function(file, extension) {},
  // Fired when file upload is completed
  onComplete: function(file, response) {},
  // Fired when server returns the string
  onSuccess: function(file){},
  // Fired when server return something else
  onError: function(file, response){}
});

});
</pre><p>And after that just upload the file using:</p><pre class="brush: php;">
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
  echo &amp;amp;quot;success&amp;amp;quot;;
} else {
  echo &amp;amp;quot;error&amp;amp;quot;;
}
</pre><p>You can find more info on: <a
rel="extern" href="http://valums.com/projects/ajax-upload/" target="_blank">http://valums.com/projects/ajax-upload/</a> or check out the demo page : <a
rel="extern" href="http://valums.com/s/p/ajax-upload/demo.htm" target="_blank">Demo</a></p> ]]></content:encoded> <wfw:commentRss>http://blog.ajaxmasters.com/ajax-file-upload-with-jquery/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 9/27 queries in 0.017 seconds using disk

Served from: blog.ajaxmasters.com @ 2010-07-31 13:45:47 -->