Jump to content

Welcome to AppCake Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!

Fileshack and the Upload API

  • This topic is locked This topic is locked
2 replies to this topic




  • IC Respected Member
  • 2,405 posts
    • Time Online: 36d 5h 9m 30s
  • Twitter:cosmicaln1nja
  • Locationthe UK
  • iDevices Owned:iPod Classic, iPhone SE, iPad Mini, iPad 4, MacBook Pro
  • Most used iOS:iOS 8

After some time i have managed to get an upload API together. It's live and it is working. This a big part towards peoples bots to automate processes. I shall be releasing it properly along with an update but wanted to give the chance for readers here to perhaps use it early. It is NOT beta testing, i just cba to write a page for it yet.


Firstly you need to get an API key from Fileshack. Please email support who can reply with the key.


This is your get request: http://fileshack.net...word=<password>


Please make sure that you're really making a POST request in a multipart-formdata format,
not as www-form-urlencoded.


Here is an example script that uploads 1 file to your account at a time.



use LWP::UserAgent;
use JSON;
use HTTP::Request::Common;
use Data::Dumper;

my ($api_key, $login, $password) = ('', '', '');

# Obtain the credentials understandeable by file server
my $ret;
my $ua = LWP::UserAgent->new;
$ret = JSON::decode_json($ua->post("http://fileshack.net/",
    'op' => 'external',
    'upload' => '1',
    'api_key' => $api_key,
    'login' => $login,
    'password' => $password,

print Dumper($ret);

# Perform an actual upload
my $req = POST $ret->{upload_url}, Content_Type => 'form-data', Content => [
    sess_id => $ret->{sess_id},
    file_0 => [ $ARGV[0] ],
    utype => 'prem',
$ret = JSON::decode_json($ua->request($req)->decoded_content);

# Output results as the download links
for my $file(@{$ret})
    print "http://fileshack.net...{file_code}\n";



Please do not be asking me to write scripts to do this and that in a multitude of languages. This is a tool to be used by people who know how to use it properly.


If however there are people wanting to write scripts in different languages and have me stick them on the site with credits to you then that is great and i can do that.

  • hotsjf, Bachitter and pacav69 like this



    7 years in scene

  • Admin
  • 7,638 posts
    • Time Online: 192d 14h 59m 9s
  • Twitter:@iphonecake_com
  • LocationUSA
  • iDevices Owned:iPod Classic, iPod Touch 4, iPhone 3GS, iPhone 4, iPhone 5S, iPhone 6+, iPad 1, iPad 3, iPad 4, iPad Air 2, Apple Watch, MacBook Air, MacBook Pro, iMac
  • Most used iOS:iOS 6, iOS 7, iOS 8

this is the PHP code that used to upload via API

function uploadtoFS($filename){
	$username = '';
	$password = '';
	$apikey = '';

	$s = file_get_contents("http://fileshack.net/?op=external&api_key=$apikey&upload=1&login=$username&password=$password");
	$ja = json_decode($s);

	$loginUrl = $ja->upload_url; 
	$session_id = $ja->sess_id;
	echo("upload URL: $loginUrl \n");
	echo("session id: $session_id \n");
	//init curl
	$ch = curl_init();
	$sessid = $session_id;

		echo("File not exist: $filename \n");
	curl_setopt($ch, CURLOPT_TIMEOUT, 6000);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,6000);
	curl_setopt($ch, CURLOPT_REFERER, "http://fileshack.net/");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_URL, $loginUrl);
	curl_setopt($ch, CURLOPT_POST, 1);
	$post = array('sess_id'=>$sessid,'file_0'=>'@'.$filename);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post);	
	$content = curl_exec($ch);
	$ja = json_decode($content);

	$filelink = "http://fileshack.net/".$ja[0]->file_code;

	return $filelink;


  • Cosmicalninja likes this



    IC Master

  • IC Respected Member
  • 527 posts
    • Time Online: 20d 4h 42m 6s
  • iDevices Owned:iPad Mini, iHave a PC
Not simple for me,but i use fileshack very much,so i will give it a try:)