API Key :
Requests api require a api key. You may request one from here :
https://upload-files.cc/?profile
1. Sending a simple upload request :
Required parameters :
Key |
Required |
Description |
uploadfile |
|
Filename |
passwordfile |
|
Password |
ispublic |
|
Public |
api |
|
API Key |
username |
|
Username |
Delphi (IDE) :
var
Form1: TForm1;
BaseUrl , userName , apikey :string ;
implementation
{$R *.dfm}
function UploadFile(Sfile:string):string;
{
const
BaseUrl ='https://upload-files.cc';
userName = '' ;
apikey = '' ; }
var
Params: TIdMultipartFormDataStream;
begin
BaseUrl := form1.Edit1.Text;
userName := form1.Edit2.Text ;
apikey := form1.Edit3.Text ;
form1.Cursor:=crHourGlass;
form1.Label1.Caption := '';
try
Params:=TIdMultiPartFormDataStream.Create;
Params.AddFile('uploadfile',pchar(Sfile),'multipart/form-data');
Params.AddFormField('passwordfile',form1.Edit4.Text);
Params.AddFormField('ispublic',IntToStr(Integer(form1.CheckBox1.Checked)));
form1.IdHTTP1.Request.CustomHeaders.Clear;
form1.IdHTTP1.Request.UserAgent:='Mozilla/5.0 (Windows NT 6.1; rv:54.0) Gecko/20100101 Firefox/54.0';
form1.IdHTTP1.Request.CustomHeaders.Add('X-Requested-With: XMLHttpRequest');
try
result:=form1.Idhttp1.post(BaseUrl+'/ajax/index.php?uploadfile&api='+apikey+'=&username='+userName,Params);
except
result:='{"success":false,"msg":"Server not responding"}';
//on E : Exception do ShowMessage(E.ClassName+' error raised, with message : '+E.Message);
end;
Finally
Params.Free ;
form1.Cursor:=crDefault;
end;
end;
PHP Language :
<meta charset="UTF-8">
<form method="post" enctype="multipart/form-data">
<input type="file" name="uploadfile">
<input type="password" name="passwordfile">
<input type="checkbox" name="ispublic" value="1" checked> is public
<input type="submit" name="">
</form>
<hr>
<?php
$BaseUrl ='https://upload-files.cc';
$userName = '' ;
$apikey = '' ;
if( $_SERVER['REQUEST_METHOD'] == 'POST' ){
$files = $_FILES['uploadfile'];
$passwordfile = $_POST['passwordfile'];
$ispublic = (isset($_POST['ispublic'])) ? '1' : '0';
$post = array(
'uploadfile'=> '@'. $_FILES['uploadfile']['tmp_name']. ';filename=' . $_FILES['uploadfile']['name'] ,
'ispublic' => $ispublic,
'passwordfile' => $passwordfile
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $BaseUrl.'/ajax/index.php?uploadfile&api='.$apikey.'=&username='.$userName);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
//curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Requested-With: XMLHttpRequest", "Content-Type: application/json; charset=utf-8"));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
//echo $response;
echo '<pre>'.json_encode(json_decode($response), JSON_PRETTY_PRINT).'</pre>';
/*$response = json_decode($response, true);
if($response['success'] == 'true')
echo '<a href ="'.$BaseUrl.'/?download='.$response['cryptID'].'">'.$response['originalFilename'].'</a>';*/
}
?>
Sample JSON response :
{
"success":true,
"FileName":"file_2018-08-11_081735.jpg",
"originalFilename":"sample.jpg",
"Icon":"icon-file-image",
"Size":7324,
"SavedFile":"..\/uploads\/file_2018-08-11_081735.jpg",
"Extension":"jpg",
"DeleteId":"kQ8fQjVW6a",
"DownloadId":"uz2y1v0L8a",
"ID":854,
"cryptID":"ODU0",
"UploadDir":"\/uploads",
"ThumbnailDir":"\/uploads\/_thumbnail\/d7e1d8ec7eb1928ec9d4aa537ee2600e.jpg",
"IsLogin":false,
"footerInfo":"Copyright © 2018. All rights reserved ( onexite )."
}
Access to API is disabled :
{
"success":false,
"msg":"Access to API is disabled",
"footerInfo":"Copyright © 2018. All rights reserved ( onexite )."
}
Invalid file type :
{
"success":false,
"msg":"Invalid file type",
"footerInfo":"Copyright © 2018. All rights reserved ( onexite )."
}
2. Uploaded files :
Required parameters :
Key |
Required |
Description |
files |
|
/ |
json |
|
/ |
currentpage |
|
Page |
api |
|
API Key |
username |
|
Username |
Delphi (IDE) :
var
Form1: TForm1;
BaseUrl , userName , apikey :string ;
implementation
{$R *.dfm}
function ListFiles():string;
{
const
BaseUrl ='https://upload-files.cc';
userName = '' ;
apikey = '' ; }
begin
BaseUrl := form1.Edit1.Text;
userName := form1.Edit2.Text ;
apikey := form1.Edit3.Text ;
form1.Cursor:=crHourGlass;
try
form1.IdHTTP1.Request.CustomHeaders.Clear;
form1.IdHTTP1.Request.UserAgent:='Mozilla/5.0 (Windows NT 6.1; rv:54.0) Gecko/20100101 Firefox/54.0';
form1.IdHTTP1.Request.CustomHeaders.Add('X-Requested-With: XMLHttpRequest');
try
result:=form1.Idhttp1.get(BaseUrl+'/ajax/index.php?files&json&¤tpage=1&api='+apikey+'=&username='+userName);
except
result:='{"success":false,"msg":"Server not responding"}';
//on E : Exception do ShowMessage(E.ClassName+' error raised, with message : '+E.Message);
end;
Finally
form1.Cursor:=crDefault;
end;
end;
PHP Language :
<meta charset="UTF-8">
<?php
$BaseUrl ='https://upload-files.cc';
$userName = '' ;
$apikey = '' ;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $BaseUrl.'/ajax/index.php?files&json¤tpage=1&api='.$apikey.'=&username='.$userName);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_POST, false);
$response = curl_exec($ch);
curl_close($ch);
//echo $response;
echo '<pre>'.json_encode(json_decode($response), JSON_PRETTY_PRINT).'</pre>';
?>
Sample JSON response :
{
"success_msg":[
{
"public":"1",
"fileid":"304",
"date":"2 weeks ago",
"size":"19,31 MB",
"folder":"\/uploads",
"filename":"file_2018-08-03_164710.3gp",
"orgfilename":"Athmane Bali - Kef Non Live.3gp",
"downurl":"\/?download=MzA0",
"downtotal":"0",
"comments":"0",
"deletehash":"'98fvzpZNZk'",
"accesspass":"0",
"cryptid":"MzA0",
"thumbnaildir":""
},
{
"public":"1",
"fileid":"301",
"date":"3 weeks ago",
"size":"26,17 KB",
"folder":"\/uploads",
"filename":"file_2018-07-30_181347.png",
"orgfilename":"index.png",
"downurl":"\/?download=MzAx",
"downtotal":"1",
"comments":"0",
"deletehash":"'LRSIkxVadM'",
"accesspass":"0",
"cryptid":"MzAx",
"thumbnaildir":"\/uploads\/_thumbnail\/6c4507d627fd5adce23607b6fa168c2a.png"
}
],
"success_totalpages":4
}
Wrong username or password :
{
"success":false,
"msg":"You must login first",
"footerInfo":"Copyright © 2018. All rights reserved ( onexite )."
}