I created a login system using php.And it can handle member profiles.But i was unable to upload profile picture.how can i do that???????

Recommended Answers

Dear Friend ,

i dont know what script u r using to store pictures.

i have a script, it can store pictures in a folder.

Script is :

<?php
$name=$_post;
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 200000))

Jump to Post

All 2 Replies

Dear Friend ,

i dont know what script u r using to store pictures.

i have a script, it can store pictures in a folder.

Script is :

<?php
$name=$_post;
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 200000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

if (file_exists("$name/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"$name/" . $_FILES["file"]["name"]);
echo "Stored in: " . "$name/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>

thanx.I mean that in my system the members should be able to upload pictures.

Be a part of the DaniWeb community

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