Hello everybody

I made an personal form to upload files to different maps wich can be selected.
I'm making an mistake, but I don't know how to fix this. There is no error only when the file is processed, the file isn't kept in the directory map wich was selected.
It echoes: "There was an error uploading the file, please try again!Smile...

This is my form:

<form enctype="multipart/form-data" action="upload.php" method="post"> 
            <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> 
            Choose a file to upload: 
  <input name="uploadedfile" type="file" /> 
  <select name="uploads" size="1"> 
  <br /> 
  <input type="submit" value="Upload File" /> 

And here is my upload script.

$sTargetPath = 'c:/wamp/www/uploading/uploads/'.((isset($_POST['uploads']) && is_string($_POST['uploads']))? $_POST['uploads'].'/' : ''); 
if(is_dir($sTargetPath) && move_uploaded_file($_FILES['uploadedfile']['tmp_name'] 
     . basename($_FILES['uploadedfile']['tmp_name']), $sTargetPath)) { 

    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded"; 

    echo "There was an error uploading the file, please try again!"; 
echo "smile..."; 

Thanks for every help and feedback

$sTargetPath = 'c:/wamp/www/uploading/uploads/'

it is better and more convenient to use relative path instead of absolute path.

$sTargetPath = 'uploading/uploads/'

Windows use \ as separator, if you insist to use absolute path. Don't forget to add another one as escape character.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.