<?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>Fri, 27 Jan 2012 15:44:56 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <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[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...]]></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">%MINIFYHTML91b6218fef0ce89417448df19dc5ff520%%MINIFYHTML91b6218fef0ce89417448df19dc5ff521%</pre><p>And after that you can add this for a div with a specific id:</p><pre class="brush: jscript; title: ; notranslate">
$(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; title: ; notranslate">
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>3</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic (User agent is rejected)
Database Caching 1/11 queries in 0.034 seconds using disk: basic
Object Caching 320/334 objects using disk: basic

Served from: blog.ajaxmasters.com @ 2012-02-05 05:26:24 -->
