Created
March 7, 2011 18:47
-
-
Save cdevroe/858967 to your computer and use it in GitHub Desktop.
ViddlerRubyUpload
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
<% | |
## Controller stuff! | |
# Assuming... require 'rubygems' | |
# Assuming... require 'viddler-ruby' | |
# Create the client and authenticate it | |
viddler = Viddler::Client.new 'YOUR API KEY' | |
viddler.authenticate! 'USERNAME', 'PASSWORD' | |
upload = viddler.get 'viddler.videos.prepareUpload' | |
@endpoint = upload['upload']['endpoint'] | |
@token = upload['upload']['token'] | |
%> | |
<!-- ## View stuff --> | |
<form method="post" action="<%=endpoint%>" enctype="multipart/form-data"> | |
<input type="hidden" name="uploadtoken" value="<%=token%>" /> | |
<input type="hidden" name="callback" value="YOUR CALLBACK URL" /> | |
<label>Title:</label> <input type="text" name="title" /><br /> | |
<label>Description:</label> <input type="text" name="description" /><br /> | |
<label>Tags:</label> <input type="text" name="tags" /><br /> | |
<label>File:</label> <input type="file" name="file" /><br /> | |
<input type="submit" value="Upload" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment