Bayfiles.com RL upload plugin & function

Status
Not open for further replies.

CJ

Active Member
3,788
2009
1,035
0
Was wondering for some free plus good filehost better then Rapidshare or Mediafire. & ShareShiz named me Bayfiles.com

I have been using it from yesterday & am kind of loving it. Totally awesome. Anyways some of the members were asking for RL upload plugin to Bayfiles.com. here it is along with a function if u has custom script. It uses Bayfiles' API

PHP:
echo uploadBF("./temp.txt");
function uploadBF($x,$retry=0)
{
	$user="";
	$pass="";
	if(trim($user)!="" && trim($pass)!="")
	{
		$page=curl('http://api.bayfiles.com/v1/account/login/'.$user.'/'.$pass.'');
		$page=json_decode($page);
		$session=$page->session;
		$page=curl("http://api.bayfiles.com/v1/file/uploadUrl?session=$session");
	}
	else
	{
		$page=curl("http://api.bayfiles.com/v1/file/uploadUrl");
	}
	$page=json_decode($page);
	$url=$page->uploadUrl;
	$page=curl($url,array('file'=>"@$x"));
	$page=json_decode($page);
	$url=$page->downloadUrl;
	if($url=="" && $retry!=1)
		return uploadBF($x,1);
	else
		return $url;
}
function curl($link, $postfields = '') 
{ 
	$ch = curl_init($link); 
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
	curl_setopt($ch, CURLOPT_HEADER, 0); 
	//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
	curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.80 (Windows NT 5.1; U; en) Presto/2.7.62 Version/11.01'); 
	if($postfields) 
	{ 
		curl_setopt($ch, CURLOPT_POST, 1); 
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); 
	} 
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
	curl_setopt($ch, CURLOPT_TIMEOUT, 1200);
	$page = curl_exec($ch);
	curl_close($ch); 
	return($page); 
}

RL PLUGIN
Code:
http://bayfiles.com/file/1tXr/AuQnIB/bayfiles-rl-plugin.rar

Cheers :D
 
Last edited:
16 comments
mibPYW.png
 
hello...
i get this error

Fatal error: Call to undefined function curl_init() in /data/multiserv/users/776434/projects/1857001/www/hosts/upload/bayfiles.com_member.php on line 70
 
Just bought an RL, can anyone tell me how to get the plugin onto my host?
I've got the ftp open but can't see where I'd put the .php files
 
RL directory/hosts/upload (or download) :)

There must be 2 files in each case,
filehost.index.php -> containing basic filehost details like max upload size
filehost.php -> containing the main codes
 
Status
Not open for further replies.
Back
Top