<?php
/******************************************************************************
HOW TO USE "PHP MEGAUPLOAD.COM CLASS"
******************************************************************************
Example #3: To upload a test file (test.txt) [caution: not for windows environment]
******************************************************************************
Author: Naveed-ur-Rehman
Email: naveed@naveedurrehman.com,
naveed.coder@gmail.com,
naveed.ur.rehman@hotmail.com
Website: http://www.naveedurrehman.com/
******************************************************************************
*/
require_once('../class/megaupload.class.php'); //php megaupload.com class file
require_once('credentials.php'); //Your signing in credentails of megaupload.com account
$megaupload = new megaupload_class(); //Initializing the class
$megaupload->username=$username; //Setting credentails (loaded from credentails.php)
$megaupload->password=$password;
$isconnect = $megaupload->connect(); //Return: 0=trouble, 1=validated and connected
if($isconnect==1)
{
echo "Credentials are verified and you are connected to megaupload.com successfully!<br/>";
$filename = "test.txt";
$details = "This is a test file";
$hotlink = 0; //0=no, 1=yes (for premium accounts only)
$newfileid = $megaupload->upload($filename,$details,$hotlink);
if($newfileid)
{echo "File has been uploaded. New file's ID is: $newfileid";}
else
{echo "Error while uploading file.";}
}
else
{
echo "Error occured while connecting to megaupload.com. May be username and/or password supplied is invalid.";
}
$megaupload->disconnect(); //Disconnect to release everything
?>
|