Ok, this is frustrating me now....
I got a code thats suppose to upload a image to your sever, and adds the path to the image and stores a name for it in the database...then relink it back to a webpage where needed...
So far, it upload the image, but chmods its 600, so it cant be rea dunless I manually change it to 666.
Also, its just not adding any info to the table I created, just doesnt wanna un the query.
Can anyone help me out?
Im totlaly new to this, so im learning as I go...heres the code I was trying to work on..probably full of bugs, hehe
I removed my pass words etc...
<html>
<head>
<title>Image Upload</title>
</head>
<form enctype="multipart/form-data"
method="post" action="<?php echo $PHP_SELF?> ">
Name:<br>
<input type="text" name="name" size="25">
<br>
Date:<br>
<input type="text" name="date" size="25">
<br>
Picture:<br>
<input type="file" name="picture" size="25">
<br><br>
<input type="submit" name="submit" value="upload">
</form>
<?php
if ($submit) {
$host="host";
$user="user";
$password="pass";
$connection = mysql_connect($host,$user,$password)
or die ("Could not connect to database.");
$db = mysql_select_db("databasename",$connection)
or die ("Could not select database")
$query = "INSERT INTO tablename (name,date,picture_name) VALUES
('$name','$date','$picture_name')";
$result = mysql_query($query)
or die ("Could not execute query")
exec("cp $picture /path/to/image/folder/$picture_name");
echo "Name: $name<br>\n";
echo "Date: $date<br>\n";
echo "Temp File: $picture<br>\n";
echo "File Name: $picture_name<br>\n";
echo "File Size: $picture_size<br>\n";
echo "File Type: $picture_type<br>\n";
echo "<br>\n";
echo "<img src=folder/$picture_name><br>\n";
}
?>
<body>
</body>
</html>