Created
September 18, 2009 16:33
-
-
Save joemsak/189160 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= stylesheet_link_tag 'swfupload' %> | |
<script src="http://www.google.com/jsapi"></script> | |
<script> | |
google.load('jquery','1.3.2'); | |
</script> | |
<%= javascript_include_tag 'swfupload', 'upload' %> | |
<script> | |
var swfu; | |
// Dom Ready | |
$(document).ready(function() { | |
// Setup SWFU object | |
var settings = { | |
upload_url: "<%= photos_path(:gallery_id => @gallery.id) %>", | |
flash_url: "/flash/swfupload.swf", | |
post_params: {session_data: "" }, | |
file_size_limit: "<%= 3.megabytes %>", | |
file_types: "*.jpg;", | |
file_types_description: "Jpg Image Files", | |
file_queued_handler: Upload.file_queued, | |
file_dialog_complete_handler: Upload.file_dialog_complete, | |
upload_start_handler: Upload.upload_start, | |
upload_progress_handler: Upload.upload_progress, | |
upload_error_handler: Upload.upload_error, | |
upload_success_handler: Upload.upload_success, | |
upload_complete_handler: Upload.upload_complete, | |
button_placeholder_id: "btnPlaceHolder", | |
button_width: "80", | |
button_height: "25", | |
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT, | |
button_cursor: SWFUpload.CURSOR.HAND, | |
custom_settings: { | |
progressTarget: "#images", | |
uploadButtonId: "#upload" | |
}, | |
debug: false // Set to true to find out why things aren't working | |
}; | |
swfu = new SWFUpload(settings); | |
// Disable Upload Button | |
$('#upload').addClass('disabled').attr('disabled', 'true'); | |
// Add Event Handlers | |
$('#upload').click(function() { swfu.startUpload(); }); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment