Location: PHPKode > projects > Mummi (Multi-user MOD_MP3 Interface) > mummi.0.6/htroot/upload.php
<?
// this might take a long time when sending big files.
set_time_limit(0);

// Setting the page title
$GLOBALS[page_title] = "HTTP File Upload";

// Include files
include "common.php";
include "$lib_path/design.inc";

// Set the user navbars.
if(!$HTTP_COOKIE_VARS[login_active]) $nav_array = array(main);
elseif($os->num_rows("SELECT user_name FROM users WHERE user_name='$session_array[user_name]' AND user_type='1'")) $nav_array = array_merge($GLOBALS[admin_navbox_array], $os->get_navbox_array($session_array[user_name]));
else $nav_array = array_merge($GLOBALS[basic_navbox_array], $os->get_navbox_array($session_array[user_name]));


// The upload path.
$upload_dir = "$GLOBALS[audio_folder]/$session_array[user_name]/new_uploads/";

//echo "upload dir = $upload_dir<br>\n";

// need to check the upload path, see if it exists.
if(!is_dir($upload_dir)) mkdir("$upload_dir", 0777);

//echo "<br>\n".serialize($HTTP_POST_FILES)."<br><br>\n";
//echo count($HTTP_POST_FILES[userfile][name])."<br>\n";
//echo $MAX_FILE_SIZE."<br>\n";



if($HTTP_POST_FILES[userfile]){
	// cycle thru the upload array
	for($i=0;$i<count($HTTP_POST_FILES[userfile][name]);$i++){
		if(is_uploaded_file($HTTP_POST_FILES[userfile][tmp_name][$i])){
			if(move_uploaded_file($userfile[$i], $upload_dir.$HTTP_POST_FILES[userfile][name][$i])){
				$ss_path = rawurlencode("/new_uploads");
				$ss_song = rawurlencode($HTTP_POST_FILES[userfile][name][$i]);
				$GLOBALS[contents00] .= "filename = <a href=\"$GLOBALS[url_path]/file.php?r_path=$ss_path&song=$ss_song\">".$HTTP_POST_FILES[userfile][name][$i]."</a><br>\n";
				$GLOBALS[contents00] .= "filetype = ".$HTTP_POST_FILES[userfile][type][$i]."<br>\n";
				$GLOBALS[contents00] .= "filesize = ".$HTTP_POST_FILES[userfile][size][$i]."<br>\n";
				$GLOBALS[contents00] .= "<hr>\n";
			}
		}
	}//eo for
}else{

	$GLOBALS[contents00] = <<<ENDcontents00

	<form action="$GLOBALS[url_path]$PHP_SELF" method="post" enctype="multipart/form-data">
	<input type="hidden" name="MAX_FILE_SIZE" value="10000000">
	<input type="file" name="userfile[]" size="40"><br>
	<input type="file" name="userfile[]" size="40"><br>
	<input type="file" name="userfile[]" size="40"><br>
	<input type="file" name="userfile[]" size="40"><br>
	<input type="file" name="userfile[]" size="40"><br>
	<input type="submit" value="Send File(s)">
	</form>

	upload dir = /$session_array[user_name]/new_uploads

ENDcontents00;
}




// an array for the draw_page function.
$contents = array("$GLOBALS[page_title]"=>"$GLOBALS[contents00]");


draw_header("$GLOBALS[page_title]");
draw_nav($nav_array);
draw_sect($contents);
draw_footer();
ob_end_flush();
?>
Return current item: Mummi (Multi-user MOD_MP3 Interface)