<?php require_once "phpuploader/include_phpuploader.php" ?>
<?php session_start(); ?>
<html>
<head>
<title>Demo 1 - use SaveDirectory property</title>
</head>
<body>
<form id="form1" method="POST">
<?php
$uploader=new PhpUploader();
$uploader->Name="myuploader";
$uploader->Render();
?>
</form>
<?php
//Gets the GUID of the file based on uploader name
$fileguid=@$_POST["myuploader"];
if($fileguid)
{
//get the uploaded file based on GUID
$mvcfile=$uploader->GetUploadedFile($fileguid);
if($mvcfile)
{
//Gets the name of the file.
echo($mvcfile->FileName);
//Gets the temp file path.
echo($mvcfile->FilePath);
//Gets the size of the file.
echo($mvcfile->FileSize);
//echo "eric1".$mvcfile->FileName."eric2";
$filename = str_replace('_', '', $mvcfile->FileName);
//echo "eric3".$filename;
$targetfilepath= "savefiles/myprefix_" . $filename;
if( is_file ($targetfilepath) )
unlink($targetfilepath);
$mvcfile->CopyTo( $targetfilepath );
//Moves the uploaded file to a new location.
//$mvcfile->MoveTo("/uploads");
//Deletes this instance.
$mvcfile->Delete();
}
}
?>
</body>
</html>