issues writing a image path to mysql database

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am having trouble writing the file path of a image to the  
database,also for some reason it is not uploading the images, anyone  
have any ideas?

the code is below:

if($_POST[Submit] == 'Submit')
         $target_path = "../reviewImages/";
         $target_path = $target_path . basename(  
$target_path)) {
             echo "The file ".  basename( $_FILES['uploadFile']['name']).
             " has been uploaded";
         } else{
             echo "There was an error uploading the file, please try  
         echo $target_path;

         $text = $_POST[text];
         $press = $_POST[press];
         $logo = "reviewImages/".basename( $_FILES['uploadFile']['name']);
         echo $logo;
         $title = $_POST[title];
         $author = $_POST[author];
         $date = $_POST['date'];

         $sql = "INSERT into reviews (press, title, author, date, text,  
imagePath) VALUES ('$press', '$title', '$author', '$date', '$text',  
         mysql_query($sql) or die(mysql_error());

         echo "Information added to the reviews table";



Re: issues writing a image path to mysql database

Check if you're using enctype="multipart/form-data" on the form. More
info here:


<form enctype="multipart/form-data" action="post.php" method="POST">
    Send this file: <input name="userfile" type="file" />
    <input type="submit" value="Send File" />

Glenn Coyle wrote:
Quoted text here. Click to load it

Site Timeline