#!/usr/bin/perl

$filename = $ARGV[0];

# Download the frontpage to get the action URL
$homepage = `curl -Ls http://www.hotfile.com`;
$homepage =~ /action="(http:\/\/.*?upload.cgi.*?)"/;
$action = $1;

# Upload the file
$result = `curl -Ls -F "iagree=on" -F "uploads[]=\@$filename" $action`;

# Extract the download link
$result =~ m|(http://hotfile.com/dl/.*?\.html)|s;
print "Download link: $1\n";

