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??

Recommended Answers

All 3 Replies

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

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

// Where the file is going to be placed 

$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!";

$sql="insert into photos (path) values('$f')";
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" />
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.