Hello basically i got a signup page and i want the user to be able to browse and upload a image and when the user clicks signup all his details and his picture will be saved to mysql database table, and when the user signs in the image appears is this possible??

the best way is not to store it in the database itself. instead, have php uplod the image to the server, and then store the path to the image in the database

Hi,
I think you can use this following code for uploading an image.

<?php
include("connect.php");
// Where the file is going to be placed 
if(isset($_REQUEST['upload']))
{

$target_path = "imag/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
	
	
} else{
    echo "There was an error uploading the file, please try again!";
}

$f=basename($_FILES['uploadedfile']['name']);
$sql="insert into photos (path) values('$f')";
$rs=mysql_query($sql);
echo "saved";
}
?>
<form enctype="multipart/form-data" action="uploader.php" method="POST" name="form1" ">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input name="upload" type="submit" id="upload" onclick="return val();" value="Upload File" />
</form>
This article has been dead for over six months. Start a new discussion instead.