Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP How to change uploaded file root path ?

Have Programming Question? Ask it here!
 
 
 


Shreepathi
How to change uploaded file root path ?
0 Answer(s)      a year and 6 months ago
Posted in : PHP


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
"; } ?>


Advertisement
View Answers

Related Tutorials/Questions & Answers:
 

 

 

DMCA.com