I'm back with more problems.
I'm getting the errors:
Warning: move_uploaded_file(images/) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/billing/vhosts/yakimaimplement.com/used_test/add.php on line 23
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpmb59hD' to 'images/' in /home/billing/vhosts/yakimaimplement.com/used_test/add.php on line 23
Sorry, there was a problem uploading your file. Please try again.
With the following code, when it is executed:
<?php
//Directory where images will be stored - need to change?
$target = "images/";
$target = $target . basename( $_FILES['photo']['model']);
//Other information
$model=$_POST['model'];
$serial=$_POST['serial'];
$application=$_POST['application'];
$pic=($_FILES['photo']['model']);
// Connect to DB
mysql_connect("localhost", "", "") or die(mysql_error()) ;
mysql_select_db("yakimaimplement") or die(mysql_error()) ;
// Write information to DB
mysql_query("INSERT INTO `used_equip` VALUES ('$model', '$serial', '$application', '$pic')") ;
//Write the photo to server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
//Tells you if all worked
echo "The file ". basename( $_FILES['uploadedfile']['model']). " has been uploaded and your entry updated.";
}
else {
//Error if didn't work
echo "Sorry, there was a problem uploading your file. Please try again.";
}
?>It doesn't seem to be a permissions problem. Again, I'm pretty new to working with SQL in PHP, so hopefully it's something simple that I'm just missing.Thanks in advance!
Edited by Alexander, 26 April 2011 - 02:37 PM.
(Removed credentials)


Sign In
Create Account


Back to top









