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

?>

Link to comment
Share on other sites

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']);

}

 

?>

Link to comment
Share on other sites

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']);

}

 

?>

Link to comment
Share on other sites

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.";

}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.