Hello all
I have a php script that uploads a file from a form into a directory. The directory is automatically created through the script.
But the upload file is not put in to the directory, but outside....
Can anyone tell what i am doing wrong....?? And perhaps tell me what to do to put the file into the created directory...?
Here is my code:
[PHP]<?php
// Your file name you are uploading
$file_name = $HTTP_POST_FILES['ufile']['name'];
// random 4 digit to add to our file name
// some people use date and time in stead of random digit
$random_digit=rand(0000,99999);
mkdir("D:\\Webs\\printline-webshop.eu\\httpdocs\\searchpro\\data\\".$random_d igit) or die ("Could not make directory");
//combine random digit to you file name to create new file name
//use dot (.) to combile these two variables
$new_file_name=$random_digit.$file_name;
//set where you want to store files
//in this example we keep file in folder upload
//$new_file_name = new upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "D:\\Webs\\printline-webshop.eu\\httpdocs\\searchpro\\data\\".$new_file _name;
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
//$new_file_name = new file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
}
else
{
echo "Error";
}
}
?>[/PHP]
Any help would gladly be appreciated...