i need to copy a file from a directory on my server to a different directory in this script after it makes the directory, this script was tested and working before i added the part i've outlined is what i'm trying to do
move dig.php from one place to other.... any ideas on what i can use?
<form method="post" action="upload.php" ENCTYPE="multipart/form-data">
<input type="hidden" action="MAX_FILE_SIZE" value="300000">
<p>
Step 1:</p>
Your forum username: <input type="text" name="username">
<p><font face="Verdana">Browse below to upload your photochops to our
gallery!!!<br>
Choose File:</font>
<input name="userfile" type="file" size="50">
<input type="submit" value="Upload File">
</p>
</form>
<?
// Create variables that are easier to process and more meaningful.
// as well as initializing other variables
$FileSize = $_FILES[userfile][size];
$FileType = $_FILES[userfile][type];
$FileName = $_FILES[userfile][name];
$FileTemp = $_FILES[userfile][tmp_name];
$FileError = $_FILES[userfile][error];
$dig = 'dig.php';
switch ($FileError){
// OK
case "0":
$i = 0; // counter used if the new directory already exists.
// Value to be used for creating a new dir.
//$NewDir = md5($filename);
mkdir("/home/tunercar/public_html/forums/memberpics/$username/");
/*****************************************
***************START OF PART NOT WORKING******/
/**************NO WORKING! THANKS EVERYONE
*********************************************/
if(!copy($dig, "/home/tunercar/public_html/forums/memberpics/$username/$dig"))
die("failure to move dig.php");
/***********END OF PART NOT WORKING******/
if (!copy($FileTemp, "/home/tunercar/public_html/forums/memberpics/$username/upload/$FileName"))
die("FAILURE in UPLOAD");
print("SUCCESS your file has been uploaded <a href=\"http://forums.tunercarz.com/memberpics/$username/upload/$FileName\">click here to see your file</a><br>");
break;
case "1":
echo"<center><H1>";
echo "ERROR: File Size is to large for PHP.INI";
echo "</center></H1>";
break;
case "2":
echo"<center><H1>";
echo "ERROR: File Size is to large for FORM";
echo "</center></H1>";
break;
case "3":
echo"<center><H1>";
echo"ERROR: File Only Partially Uploaded";
echo "</center></H1>";
break;
case "4":
echo"<center><H1>";
echo "ERROR: No FILE to Upload";
echo "</center></H1>";
break;
}
// If there is an error processing file, then echo to user
// Otherwise process email response and files.
if ($FileError){
echo"There was an error Processing this request, <br>\n";
echo"If problem persists, please contact the sytems administrator<br>\n";
echo"and let them know the <b>EXACT</b> wording of the error<br>\n";
die();
}// end of If there was an error
echo"<br><br><br>";
?>
the bold part is my attempt with no luck whatsoever, it throws this error on first page load not after i hit the upload file
Parse error: parse error, unexpected T_STRING in /home/tunercar/public_html/forums/upload.php on line 48
i was thinking i might be able to use ftp.... but how would i do that? and that's not as safe is it? i'm not sure but...
i was gonna use move_uploaded_file() but it seems that it will remove the original file 🙁
thanks all 🙂