Avatar upload and quck set

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Avatar upload and quck set

    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
    Last edited by shakil420; 19.07.10, 19:50.

    #2
    Pls p0st link

    Comment


      #3
      anyone pls paste the wml code here

      Comment


        #4
        i posted one in lava mods topic ages ago lol ...not very safe 1 tho lol

        Comment


          #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

          Comment


            #6
            it should do .... its probably a wrong folder name/ address .... might need a / infront of path address see below
            PHP Code:
            }else if($action=="uploadav"){ 
            echo 
            '<form enctype="multipart/form-data" action="genproc.php.php?action=uploadav&amp;sid=$sid" method="POST"> 
             Pic: <input name="pic" type="file"/><br/> 
             <input type="submit" value="Upload"/> 
             </form>'


            PHP Code:
            }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/>"



            Last edited by something else; 20.07.10, 17:18.

            Comment


              #7
              Thank u bro

              Comment


                #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
                PHP Code:
                    ///////////////////////////////////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&amp;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

                PHP Code:
                //////////////////////////////////////////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>";



                Comment

                Working...
                X