Added: 2 years ago
From: phpacademy
Views: 12,949
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (53)

Sign In or Sign Up now to post a comment!
  • what happens if a user uploads an image with the same name?

  • Works awesome I added a user profile image to my site! Your PHP tutorials are very useful and cool!

  • muito bom, mesmo nao sabendo inglês entendi muito, parabéns!

  • Thanks A Lot! :D

    I Have A Question.

    I have a profile page which contains the upload file from this tutorial...and there's a link on the profile page saying 'Upload avatar'! When I upload a new picture...the avatar in profile doesn't change! :/ The image is saved in the AVATARS folder but isn't shown in profile....

    Can you tell me how to change the profile picture when a person uploads a new picture.

  • Comment removed

  • Anyone having an issue with the end bit..?

    "Hey :)

    I have got everything working except the very end put which is displaying the image.

    It doesn't seem to like my below bit. I get the error:

    "Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in [location to line of IF statement below]" if (mysql_num_rows($query2) == 0)

  • @xbriskx make sure this is what you have in ur query ..... WHERE username='$username'");

  • Great tutorial, i managed to get it all working!

    But how can i set a default image for users who haven't set an image?

    I tried to set it as the default in phpmyadmin but it does work :(

    Help would be great!

  • @BenLancaaster have you any registration form for new user? you can set default image in query that creates one than use script from this tutorial, in phpmyadmin I can't set default value too...

  • Perfect! Thanks so much :)

  • THANKS A LOT!!!!! very helpful for starters like me and for those who are developing their 1st dynamic website using PHP!

  • great tut ! gud job alex !

  • @DZBrahim Ok ! Alex I did it Thankx a lot.

  • I get this when i try uploading :

    Warning: move_uploaded_file(../users/av­atars/avatar.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /Users/Muhammad_Osama/Sites/Pr­oject B/PHP/signup.php on line 73

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/Applications/XAMPP/xamppfile­s/temp/phpcTPNyQ' to '../users/avatars/avatar.jpg' in /Users/Muhammad_Osama/Sites/Pr­oject B/PHP/signup.php on line 73

  • @TheOsama1994 I just didnt had full rights to the folder :D

  • what if two users have a same image name when they upload it??

  • @TheOsama1994 @kalipsso1 Create folders within the avatar folder that corresponds to the user's id. These folders can be made automatically after registration. Then just change the $location to the correct directory using the proper valuables.

  • I've made the base of my script using this tutorial. I've also sorted out how to manage filenames so they won't mess up when two files have the same name. They are named after the ID of the user who uploads it. The only problem what stands is that people are still able to upload images with weird proportions so it wont fit in as an avatar picture.

    If you have time for it, will you maybe make an extention to this tutorial? I loved it!

  • Hello Alex do you have any examples of how to create school class schedule in php?

  • What happens if two users upload a file with the same name?

    Lets say "alex" uploads a file with name "avatar.jpg" and "kyle" uploads a file with the name "avatar.jpg".

    It will mess up their avatars...

  • @kalipsso1

    in ur mysql query you would specify a UNIQUE value using the primary key (id) field he included..

  • @kalipsso1 could be fixed by changing the name to md5("random string").jpg

  • nice tutorial

  • Hey alex, i've been following yo image upload series but i was making mine a music upload site and i want to display the login success at the profile page and not at the registration page. i want the user to see the login success msg in their profile and not keep seeing the regstrtn form. help?

  • What if two users have the same name of a file?

  • Thank you so much! your tutorials are the best!

  • Just wondering if anyone else has had the problem with the "User not found" error? If so / or not, could you look at my code and see if you find anything odd about the code?

    Thanks :O)

  • Comment removed

  • very helpful, thanks!

  • Hi Alex, thanks for this great script :) Makes my site look allot more presentable and personal for the user!

  • Just noticed that when adding .png in the end in location does as the file gets converted to a .png while even if it's .gif or .jpg

  • I made as the script saves as "Username.png" in that way it will overwrite your previous image, instead one user having tons of uploaded images.

    This is what i did:

    $location = "avatar/$session->username.png­";

    $session->username displays the username i'm logged in as, your "display-username-script" may be different.

  • Thanks for the videos! I it wasn't that easy to make it work, i had to edit some scripts, but it works!

    The script i was having problems with is the picture display script, but this is how it ended up working:

    <img src="<? echo $req_user_info['avatar'];?>">

    (Request the source from the php script that looks at my mysql table named 'avatar', and convert it into a direction (avatar/image.png)

    it even worked when viewing another member profile's picture when logged in to another account

  • @xXZarlachXx

    Did you have problems with the error "User not found" showing up? I can't seem to get past that error unless I take out the mysql_num_rows from the (query)==0 part. But then I only have a blank box show up with no image........

  • @aaronmisty08

    I meant mysql_num_rows from the ($query)==0

  • Thanks so very much for this! You've helped me out tremendously! ^_^

  • i really like your tutorials ...hope you do more ...tnx

  • hi alex..you are such a great teacher..i just want to ask you if you can upload a video about how to view a friends profile..just like in FS or FB..

    thanks in advance..

    this will help me alot..

  • @philyow060391 ya good idea i really want to know how to do that too because im creating a social network.

  • East or west alex are the best of the best........hi alex i m from india.......your tutorials help me a lot

  • Hi alex,

    i love you tutorials, they really do help a lot, i was wondering, if you could show a way of changing a profile picture and it overwrites the image in FTP because many people would like this feature. and also viewing other peoples profiles would be huge

  • Alex im encountering a major problem.

    When i apply this on my image sharing site

    I couldnt register another account anymore

    and i could only log in with the user that i typed in my upload.php What do you think is wrong ? Please help me.....

  • i'm willing to bet you forgot to destroy sessions :)

  • how can i test if an image exist?

  • helpful thanks

  • Fantastic tutorial!

    Thanks a lot Alex!

  • How can i show other users my avatar ?

  • you could make another page altogether, like a unique profile page for each unique user, and echo that user's avatar onto their profile page so all can see.

  • lol yea, now i know how, i learned how to make a community-like forums but its pretty easy for me now :) thnx thou

  • thanks =D it worked perfect :)

  • thanks! really cool :) all your tutorials are helping me a lot to do my thesis!!!

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more