Jump to content

[SOLVED] upload problem


grlayouts

Recommended Posts

the code i have uploads the file ok but it's not placing the images location into the database. the error i get is Could not update database". but i cant see the problem?

 

move_uploaded_file($_FILES["file"]["tmp_name"],
      'uploads/'. $_FILES["file"]["name"] .'');
      echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
  print '<p>'.$type.'</p>';
  $fileName = $_FILES['file']['name'];
  mysql_query("insert into images (user, image) values('$stat[id]','$fileName')") or die("Could not update database.");
      }
    }
  }

Link to comment
https://forums.phpfreaks.com/topic/56871-solved-upload-problem/
Share on other sites

For starters, where do you define $stat[id]?

 

<?php

move_uploaded_file($_FILES["file"]["tmp_name"],
      'uploads/'. $_FILES["file"]["name"] .'');
      echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
  print '<p>'.$type.'</p>';
  $fileName = $_FILES['file']['name'];
  mysql_query("insert into images (user, image) values('$stat[id]','$fileName')") or die("Could not update database: ".mysql_error());
      }
    }
}

?>

 

Run that and see what the mySQL error is.

Link to comment
https://forums.phpfreaks.com/topic/56871-solved-upload-problem/#findComment-280983
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.