Skip to content

Instantly share code, notes, and snippets.

@cdevroe
Created March 7, 2011 18:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdevroe/858967 to your computer and use it in GitHub Desktop.
Save cdevroe/858967 to your computer and use it in GitHub Desktop.
ViddlerRubyUpload
<%
## 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