Page 1 of 1

Problem saving into folder name declared as variable.

Posted: Sun Mar 29, 2009 7:51 pm
by sluke
Hiya I'm having trouble modifying getting the below code to work. It's basicaly the php code to a flash picture upload tutorial.

The problem is with the $uploadDirectory variable. If I change the $fVar1 to the name of a folder in my localhost the file will be saved correctly, however if it stays as $fVar1 the file doesn't save? Any idea what might be wrong?

Code: Select all

<?php
 
    $fVar1 = $_POST['id'];
    $fVar2 = $_POST['filename'];
    $fVar3 = "test";
 
    mkdir("$fVar1");
 
 if (is_uploaded_file($_FILES['Filedata']['tmp_name'])){
 
    $uploadDirectory="$fVar1/";
    $uploadFile=$uploadDirectory.basename($_FILES['Filedata']['name']);
 
    copy($_FILES['Filedata']['tmp_name'], $uploadFile);
          
 }
?>
Cheers in advance

Sluke