corillo181 Posted May 3, 2006 Share Posted May 3, 2006 i'm using this code to upload files to my database and a directory.. bu the problem is that once is uploaded, the picture comes out as a FORBIDDEN view file..[code]<?php$uploadDir = 'xml/';if(isset($_POST['upload'])){$fileName = $_FILES['userfile']['name'];$tmpName = $_FILES['userfile']['tmp_name'];$fileSize = $_FILES['userfile']['size'];$fileType = $_FILES['userfile']['type'];$filePath = $uploadDir . $fileName;$result = move_uploaded_file($tmpName, $filePath);if (!$result) {echo "Error uploading file";exit;}include 'config/db.php';if(!get_magic_quotes_gpc()){$fileName = addslashes($fileName);$filePath = addslashes($filePath);} $query = "INSERT INTO upload2 (name, size, type, path ) "."VALUES ('$fileName', '$fileSize', '$fileType', '$filePath')";mysql_query($query) or die(mysql_error());}?>[/code] Link to comment https://forums.phpfreaks.com/topic/8996-file-uploads/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.