...

View Full Version : simple upload scripts problem



graham23s
08-30-2007, 11:28 PM
Hi Guys,

this tiny bit of code doesnt seem to be moving the files to the destination folder:


foreach ($_FILES['nzb']['name'] as $key => $value) {

$target = "nzbs/";
$target = $target_path.basename($value);

move_uploaded_file($_FILES['nzb']['tmp_name'][$key], $target);

}

when i print_r(); all the variables are displayed in the array fine, have i missed a bit of code at all?

thanks guys

Graham

_Aerospace_Eng_
08-30-2007, 11:33 PM
Post your form code.

CFMaBiSmAd
08-30-2007, 11:36 PM
Echo out $target, I think you will find it does not contain what you expect -

$target = "nzbs/";
$target = $target_path.basename($value); I think you want the first variable there to be $target_path

graham23s
08-31-2007, 12:17 AM
Hi Guys,

changed it slightly:


foreach ($_FILES['nzb']['name'] as $key => $value) {

$target_path = "nzbs/";
$target_path = $target_path . basename($value);

echo $target_path;

move_uploaded_file($_FILES['nzb']['tmp_name'][$key], $target_path);

}

when i echo out target_path i get:


nzbs/nzbs/

it should only be 1 nzbs, but it adds two on for some reason

cheers

Graham



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum