I’ve been trying to get uploadify to work, but can’t. I am following the
tutorial by John Nunemaker.
Mine seems to be quite basic, but I just can’t figure why it wouldn’t
work…
In my layouts/application.html.erb
<%= javascript_include_tag 'uploadify/jquery-1.3.2.min.js' %>
<%= javascript_include_tag 'uploadify/jquery.uploadify.v2.1.0.min.js'
%>
<%= javascript_include_tag 'uploadify/swfobject.js' %>
<%= javascript_include_tag :defaults %>
In my view,
<%- session_key_name = ActionController::Base.session_options[:key] -%>
<script type="text/javascript">
$ = jQuery.noConflict();
$(document).ready(function() {
$('#upload_files').uploadify({
'uploader' : '/javascripts/uploadify/uploadify.swf',
'script' : '/javascripts/uploadify/uploadify.php',
'multi' : true,
'scriptData' : {
'<%= session_key_name %>' :
encodeURIComponent('<%= u cookies[session_key_name] %>'),
'authenticity_token' :
encodeURIComponent('<%= u form_authenticity_token if
protect_against_forgery? %>')
}
});
});
</script>
<input type="file" name="upload_files" id="upload_files" />
When the page is loaded I get the following error in Firebug
$("#upload_files").uploadify is not a function
What gives?
I could really appreciate someone’s help on this.
Thank you in advance!