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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.