I cant seem to upload a file in php to my server from just anywhere, it will only upload correctly if the file is in the same folder as my upload script which is a serious problem if i want the user to be able to upload from just anywhere.
here is my full code:
require ('dbconnect.php'); // connect to database
// initial database stuff
set_time_limit(0);
ini_set('memory_limit', '1024M');
$file = $_FILES["file"]["name"];
$file_handle = fopen($file, "r");
$count= 1;
mysql_query("TRUNCATE TABLE numdata") or die("MySQL Error: " . mysql_error()); //Delete the existing rows
while (($data = fgetcsv($file_handle, 0, ",")) !== FALSE)
{
foreach($data as $row)
{
if($count % 2)
{
$complete = $row;
}
else{
$complete .= $row;
$insertArray[] = $complete;
}
$count++;
$query="INSERT INTO numdata(numb) values($complete)";
}
mysql_query($query) or die(mysql_error());
}
fclose($file_handle);
how do i change the code to enable uploads from any location, or is there a setting i need to change for my server? Any help is greatly appreciated!
Thanks for your time and wisdom.