Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/example9_delete.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Naveed ur Rehman  >  PHP Megaupload.com Class  >  examples/example9_delete.php  >  Download  
File: examples/example9_delete.php
Role: Example script
Content type: text/plain
Description: Delete files and folders (in root or in sub-folder)
Class: PHP Megaupload.com Class
Manage files and folders megaupload.com accounts
Author: By
Last change:
Date: 2011-07-10 15:05
Size: 1,898 bytes
 

Contents

Class file image Download
<?php
/******************************************************************************
                     HOW TO USE "PHP MEGAUPLOAD.COM CLASS"
 ******************************************************************************
 Example #9: Delete files and folders (in root or in sub-folder)
 ******************************************************************************
       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/>";

 
//Note: See example2_refreshlist.php for getting file and folder IDs

 
$fileids = array(            //You can add more files
            
"NMUSW628",
        );

 
$folderids = array(            //You can add more folders
            
"UQEUOPUN",
        );

 
$infolder "";            //Empty if it is root folder, otherwise give folder's id    

 
$megaupload->delete($fileids,$folderids,$infolder); //Note: There is no way to confirm success

 
echo "File and folders are deleted.";
}
else
{
 echo 
"Error occured while connecting to megaupload.com. May be username and/or password supplied is invalid.";
}

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

?>