hisham
IS-IT--Management
- Nov 6, 2000
- 194
Am trying to upload images using the following code:
myfotos.php:
<?php
//connection and header go here
$split = explode(".", $photo_name);
$ext = strtolower($split[1]);
if ($ext == "jpg" || $ext == "gif" || $ext == "jpeg" {
$time = time();
$file = "images/$time-$photo_name";
move_uploaded_file($photo, "$file"
}
if($submit){
mysql_query("INSERT INTO fototbl (name,foto) VALUES ('$name','$file')"or die ("Error in query: $query. " . mysql_error()) ;
}
?>
<form action="myfotos.php" method="post" enctype="multipart/form-data">
<td><input type="text" name="name"></td>
<td><input type="file" class="input" name="file">
<td><input type="submit" value="Send" name="submit"></td>
</form>
When I checked the table fototbl, I found the data in the name field is perfect, but in the foto field I found: /tmp/phpSTFJV9
and the image was not uploaded to images directory.
Any help please?
Thanks in advance
myfotos.php:
<?php
//connection and header go here
$split = explode(".", $photo_name);
$ext = strtolower($split[1]);
if ($ext == "jpg" || $ext == "gif" || $ext == "jpeg" {
$time = time();
$file = "images/$time-$photo_name";
move_uploaded_file($photo, "$file"
}
if($submit){
mysql_query("INSERT INTO fototbl (name,foto) VALUES ('$name','$file')"or die ("Error in query: $query. " . mysql_error()) ;
}
?>
<form action="myfotos.php" method="post" enctype="multipart/form-data">
<td><input type="text" name="name"></td>
<td><input type="file" class="input" name="file">
<td><input type="submit" value="Send" name="submit"></td>
</form>
When I checked the table fototbl, I found the data in the name field is perfect, but in the foto field I found: /tmp/phpSTFJV9
and the image was not uploaded to images directory.
Any help please?
Thanks in advance