How to change uploaded file root path ?

How to change uploaded file root path ?

I have file upload php script. File upload working is good. But I can't find where saving that file. I think the files saving in mysql directory. How to change directory to my desired path ? like "uploads/"

upload.php script :

if(isset($POST['upload']) && $FILES['userfile']['size'] > 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $FILES['userfile']['tmpname']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type'];

$fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp);

if(!getmagicquotes_gpc()) { $fileName = addslashes($fileName); }

include 'library/config.php'; include 'library/opendb.php';

$query = "INSERT INTO upload (name, size, type, content ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$content')";

mysql_query($query) or die('Error, query failed'); include 'library/closedb.php';

echo "
File $fileName uploaded
"; } ?>

View Answers









Related Tutorials/Questions & Answers:

Ads