Jump to content

i cannot get this variable to work in the script


madspof

Recommended Posts

i have the variable of the folder name save in $namecookie which belongs to a upload script that is built of js and php and i want to put that variable in the copy($file['tmp_name'],"./$namecookie/".$file['name']); as you can see i think that is correct but when i run the script it does nt upload the file

 

<?php

include "../status.php";

$cookie_info = explode("-", $_COOKIE['cookie_info']);

$namecookie = $cookie_info[0];

foreach ($_FILES as $file) {

copy($file['tmp_name'],"./$namecookie/".$file['name']);

}

 

Has anyone any ideas

?>

i no have this code but i am sill having no look  this is a bit advnaced for me and i dont think i am doing th right thing with the echo here:

 

<?php

include "../status.php";

$cookie_info = explode("-", $_COOKIE['cookie_info']);

$namecookie = $cookie_info[0];

foreach ($_FILES as $file) {

copy($file['tmp_name'],"./echo $namecookie/".$file['name']);

}

 

?>

woops forgot:

 

and delete this /echo $namecookie/

 

<?php

include "../status.php";

$cookie_info = explode("-", $_COOKIE['cookie_info']);

$namecookie = $cookie_info[0];

foreach ($_FILES as $file) {

  echo $namecookie

  copy($file['tmp_name'], $file['name']);

}

 

?>

if anyone wondered i used this script in the end i moddded it so that it fitted my need and i am gonig to progress onto limmiting the download but here is the basic script

 

<?php

include "../status.php";

$cookie_info = explode("-", $_COOKIE['cookie_info']);

$namecookie = $cookie_info[0];

$target = "$namecookie/";

$target = $target . basename( $_FILES['uploaded']['name']) ;

$ok=1;

if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))

{

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

}

else {

echo "Sorry, there was a problem uploading your file.";

}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.