hi i am working in php. and my assigned task is to upload a file and save it into the directory. i have install wamp into D-drive but it not working and dont get the path. i was trying the following:

<?php
  echo "Upload: " . $_FILES["file"]["name"] . "<br>";
  echo "Type: " . $_FILES["file"]["type"] . "<br>";
  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
  echo "Stored in: " . $_FILES["file"]["tmp_name"];
?>

its don't get the path of tem_name while if i install the wamp into C: it gets the folder and store the file into it. what the problem with this code? why it couldn't get the folder name??

You mean that everything else is working (e.g. var_dump($_FILES["file"]["name"]) is correct) but the temporary file in the file system ( e.g. var_dump($_FILES["file"][" tmp_name"]) ) isn’t ?

If this is the case what outputs the last statement;

in the following link i have both html and php codes for which i was trying.

string '' (length=0) is the output when i use var_dump($_FILES["file"]["tmp_name"]) for the folder

Member Avatar for diafol

place

phpinfo();

into this file and search for upload_tmp_dir

have a look to see where it's pointing

$temp_file = sys_get_temp_dir();
echo $temp_file;
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.