Code: Select all
mkdir("$user");
touch("$user/index.php");
$file_dir="home/user/public_html/community/tmp";
if($fupload_type == "image/gif")
{
copy($fupload, "$user/$fupload_name");
}Scott
Moderator: General Moderators
Code: Select all
mkdir("$user");
touch("$user/index.php");
$file_dir="home/user/public_html/community/tmp";
if($fupload_type == "image/gif")
{
copy($fupload, "$user/$fupload_name");
}Code: Select all
<?php
$limit_ext = "yes"; //limit the file type uploads
$ext_count = "4"; //number of types allowed
$extensions = array(".twa",".zip",".txt",".zrx"); //allowed file extensions
// name of the directory that your uploads will be kept in
$dirname = "files/";
// the path that the uploads directory will be placed in
// the full path of something like: http://www.codephobia.com/test/
define(PATH, "/var/www/myspace/");
// gets just the file name and extension from the file input
// in the form
$filename = $myfile_name;
// check if they actually placed something in the file input
if ($filename != "")
{
// check if the directory exists
// if it doesnt exist, make the directory
if (!$dir = @opendir(PATH.$dirname))
// make the directory (sets chmod to 700)
mkdir(PATH.$dirname, 0777) or die("<b>Error:</b> could not make directory.");
//--------
$words = strtolower($filename);
$ext = strrchr($words,'.');
if (($limit_ext == "yes") && (!in_array($ext,$extensions))) {
echo "File is wrong type";
exit;
}
//-------------------
if(file_exists(PATH.$dirname.$filename)) {
echo "File already exists";
exit;
}
// copy the file from the temporary upload position to where you want it
copy($myfile, PATH.$dirname."/".$filename) or die("<b>Error:</b> could not copy file.");
// delete the temporary uploaded file
unlink($myfile) or die("<b>Error:</b> could not delete uploaded file.");
// tell them it worked
echo "File uploaded successfully.<BR>";
}
else
{
// tell them to browse for a file
echo "You must select a file to upload.";
}
?>