Wednesday, September 9, 2009

File Upload using AJAX and jQuery.

File Upload using AJAX and jQuery.

File upload using jQuery is preety simple.

NOTE: please include the jQuery Library afer prototype.js

As you can in the above example I had declared “jQuery.noConflict();” the reason behind this is to abvoid the conflict between jQuery library and prototype.js.

<% remote_form_for :some_random_name, @some_object, :url => {:action => 'testtest'},
:html => { :multipart => true, :id => "upload_form" } do |f| %>


<%= file_field_tag "test" "uploaded" %>
< id="button" class="button" value="Add File" type="button">
< id="save" class="save" value="Upload" type="submit">
<%end%>

Thats it.

No comments: