PHP Classes

File: examples/example3_upload.php

Recommend this page to a friend!
  Classes of Naveed ur Rehman  >  PHP Class  >  examples/example3_upload.php  >  Download  
File: examples/example3_upload.php
Role: Example script
Content type: text/plain
Description: To upload a test file (at
Class: PHP Class
Manage files and folders accounts
Author: By
Last change:
Date: 11 years ago
Size: 1,795 bytes


Class file image Download
                     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

require_once('../class/megaupload.class.php'); //php class file
require_once('credentials.php'); //Your signing in credentails of account

$megaupload = new megaupload_class(); //Initializing the class

$megaupload->username=$username; //Setting credentails (loaded from credentails.php)

$isconnect = $megaupload->connect(); //Return: 0=trouble, 1=validated and connected

"Credentials are verified and you are connected to 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);

"File has been uploaded. New file's ID is: $newfileid";}
"Error while uploading file.";}
"Error occured while connecting to May be username and/or password supplied is invalid.";

$megaupload->disconnect(); //Disconnect to release everything