9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/dumpy.rb', line 9
def self.upload(filename)
url = "http://dumpy.io/upload.php"
download_link = "http://dumpy.io/download.php?q="
begin
current_dir = `pwd`
file = current_dir.strip + "/" + filename
begin
data = RestClient.post(url, :file => File.new(file))
rescue => e
puts "Upsss... Something went wrong"
end
data = JSON.parse(data)
Clipboard.copy download_link+data[0]
puts "Your link was copied to your clipboard. Just paste it! \nThe download link will be valid for 3 days. \n:-) \n"
rescue => er
puts "Upssss... Something went wrong"
end
end
|