Skip to content

Instantly share code, notes, and snippets.

@tibbon
Created November 18, 2011 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tibbon/1375104 to your computer and use it in GitHub Desktop.
Save tibbon/1375104 to your computer and use it in GitHub Desktop.
Debugging file upload
post '/file_upload' do
@skype_name = params[:user]
if params[:action] == "FILE-UPLOAD"
unless params[:name].match(/\.jpg|png|jpeg/).nil?
current_user = User[:skype_name => @skype_name, :current_account => "1"]
client = current_user.authorize_to_twitter
datafile = Tempfile.new(params[:data])
client.update_with_media("File upload from Skype: ", datafile)
return "text: File posted."
datafile.unlink
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment