lib/rcapr/rcaprapi.rb
# Given a file, upload the file
Given a file, upload the file
Given a file upload the file
def upload(file)
    raise "File does not exist" unless File.exist?(file)
    result = @res["/upload"].post, { :file => File.read(file), :description => "Testing the API", :tags => "api" }
    return nil if result.nil?
    return result.to_json
  rescue
    puts $!
    return {:okay => false}.to_json
  end
def upload ( file ) raise "File does not exist" unless File . exist? ( file ) result = @res [ "/upload" ] . post , { :file => File . read ( file ) , :description => "Testing the API" , :tags => "api" } return nil if result . nil? return result . to_json rescue puts $! return { :okay => false } . to_json end
Given a file, upload the file
Given a file upload the file
#result = `curl --basic -u #{@auth[:username]}:#{@auth[:password]} -F file=@#{file} -F description="testing the API" -F tags="api" http://www.pcapr.net/api/upload`
file
<not_specific>