PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have currently been working with a php upload script that works, but uploads to the same directory as the file... I have been searching for a way to upload to a specific directory ie. /uploads/ but can't seem to get it working.. here is my code that i have so far... (mind you this is only the php file):
<?
if ($HTTP_POST_VARS['submit'])
{
$source = $_FILES['file']['tmp_name'];
$sourceend = $_FILES['file']['name'];
$path = "uploads/";
if (!is_uploaded_file($source))
{
$error = "You did not upload a file!";
@unlink($source);
print "You did not enter a file to upload.";
}
else
{
$maxfilesize=300000;
if ($source > $maxfilesize)
{
$error = "File is too large.";
@unlink($source);
}
else
{
@chmod($path, 01777);
@copy($source, $path . $sourceend);
@unlink($source);
@chmod($path, 01744);
}
print "File has been successfully uploaded!<br><a href="index.html">Click here to Return</a>";
exit;
}
}
?>
Any help would be GREATLY appreciated!
Last edited by Method on Tue Aug 26, 2003 10:28 pm, edited 1 time in total.