Included file URL

<?php

$file_url = 'http://' . $_SERVER['SERVER_NAME'] . str_replace($_SERVER['DOCUMENT_ROOT'],'',dirname(__FILE__)) . '/';

?>

Allow Extensions

$allowedExtensions = array("pdf","doc","docx","txt","rtf");
$tmp_nme = $_FILES['resume']['tmp_name'];
$nme = $_FILES['resume']['name'];
if(in_array(end(explode(".",strtolower($nme))),$allowedExtensions)){
$ipath= $path."/".$nme;
copy($tmp_nme, $ipath);
chmod($ipath, 0777);
}

List directory contents

function getDirectoryList($directory){
$results = array();
$handler = opendir($directory);
while ($file = readdir($handler)) {
// if file isn't this directory or its parent, add it to the results
if ($file != "." && $file != "..") $results[] = $file;
}
closedir($handler);
return $results;
}

Create file with php

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Bobby Boppern";
fwrite($fh, $stringData);
$stringData = "Tracy Tannern";
fwrite($fh, $stringData);
fclose($fh);

File Exists Function

$uploads = wp_upload_dir();
$wp_upload_directory = $uploads['basedir'];
//Check if quantum uploads exists and create
if (file_exists($wp_upload_directory . "/myNewDirectory")){
//Do Nothing
}
else {
mkdir($wp_upload_directory . "/myNewDirectory", 0777);
}