Avatar upload and quck set

Started on the old forum in July 2010 · view the original in the archive · old links redirect here

7 replies · 786 views · started 16 years ago · 1 min read

3 participants
shakil420 Developer · 125 posts #1

H0w can i add a picture uploader in lavalair profile? When any one upload a photo it will instantly setup his profile picture . Is it possible?@wapmasters

Added after 2 minutes:

Pls help me. .make sure user cant upload any kind of shell.php.jpg files thank u

shakil420 Developer · 125 posts #3

anyone pls paste the wml code here

shakil420 Developer · 125 posts #5

something else bro @ but after upload it doesnot set as profile picture i want to upload a photo which will automatically set ones profile picture...thanx for response

something else Fellow · 2,296 posts #6

it should do .... its probably a wrong folder name/ address .... might need a / infront of path address see below

}else if($action=="uploadav"){ 
echo '<form enctype="multipart/form-data" action="genproc.php.php?action=uploadav&sid=$sid" method="POST"> 
 Pic: <input name="pic" type="file"/><br/> 
 <input type="submit" value="Upload"/> 
 </form>'; 
} 
}else if($action=="uploadav"){ 
$path="avatars/".$HTTP_POST_FILES['pic']['name'];  // change avatars to your folder name
if($pic!="none") 
{ 
if(copy($HTTP_POST_FILES['pic']['tmp_name'], $path)) 
{ 
echo "Successful<br/>";  
mysql_query("UPDATE ibwf_users SET avatar='".$path."' WHERE uid='".$uid."'");  
//line above might need changing to 
// mysql_query("UPDATE ibwf_users SET avatar='/".$path."' WHERE uid='".$uid."'");
} 
else 
{ 
echo "Error<br/>"; 
} 
} 
} 
joyahm Newbie · 2 posts #8

Thanks

Thanks for this helpful code, but when i was put that, that was not working. after this little change on code that's working as well.... thanks again. on index.php

	///////////////////////////////////Settings

else if($action=="uploadav")
{
  echo "<head>";
  echo "<title>$sitename- User Settings- Avatar</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
	include("header.php");
  echo "<p align=\"center\">";
  echo "<b>Select a Picture to Set as Your Avatar</b>";
  echo "</p>";
  echo "<p>";
  echo "<form enctype=\"multipart/form-data\" action=\"genproc.php?action=uploadav&sid=$sid\" method=\"POST\"> 
 Select Avatar: <input name=\"pic\" type=\"file\"/><br/> 
 <input type=\"submit\" value=\"Upload\"/> 
 </form>"; 
  echo "</p>";

    include("footer.php");
    echo "</body>";
	}

and on genproc.php

//////////////////////////////////////////Upload Avater
else if($action=="uploadav")
{ 
$path="../avatars/".$HTTP_POST_FILES['pic']['name'];  // change avatars to your folder name
if($pic!="none") 
{ 
if(copy($HTTP_POST_FILES['pic']['tmp_name'], $path)) 
{ 
  echo "<head>";
  echo "<title>$sitename- Upload Avatar Successful</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  include("header.php");
  echo "<p align=\"center\">";
echo "Avatar Changes Successful<br/>";
mysql_query("UPDATE ibwf_users SET avatar='".$path."' WHERE id='".$uid."'");  
  echo "</p>";
  include("footer.php");
  echo "</body>"; 
  }
else 
{ 
      echo "<head>";
      echo "<title>$sitename- Upload Avatar Failed</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
	  include("header.php");
  echo "<p align=\"center\">";
echo "Avater Changes Failed<br/>"; 
  echo "</p>";
  include("footer.php");
  echo "</body>";
} 
} 
}

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close