0

i am working on a project which has user profile and need to upload an avatar. i have no idea on how to code using php the upload avatar function. any idea?
any help would be appreciated! tnx

5
Contributors
8
Replies
9
Views
9 Years
Discussion Span
Last Post by helpless_101
0

i don't think its as easy as you think mate...

On the html you need to add this:
<input type="file" name="uploadFile">

And on the page that checks and stores everything int he database you'll need to add AT LEAST this:

move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'], 
       "../uploads/{$_FILES['uploadFile'] ['name']}")

You really should read the tutorials I posted above... there's no quick way of doing this... because you'll have to check the avatars are within a certain size limit and if not then reduce them etc...

Good luck.

0

i don't think its as easy as you think mate...

On the html you need to add this:
<input type="file" name="uploadFile">

And on the page that checks and stores everything int he database you'll need to add AT LEAST this:

move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'], 
       "../uploads/{$_FILES['uploadFile'] ['name']}")

You really should read the tutorials I posted above... there's no quick way of doing this... because you'll have to check the avatars are within a certain size limit and if not then reduce them etc...

Good luck.

Not only that but especially with uploads you need verification of the file extension at least. I use ftp storage because I don't believe that any directory should provide the correct permissions to upload to. This also keeps the files away from your docroot just in case a bad file did get past your verification process and leaves that problem with the ftp server admin. PHP has a whole slew of functions for working with ftp which you can probably find just by going to php.net and searching for ftp, they also have a whole section on handling file uploads too.

0

Not only that but especially with uploads you need verification of the file extension at least. I use ftp storage because I don't believe that any directory should provide the correct permissions to upload to. This also keeps the files away from your docroot just in case a bad file did get past your verification process and leaves that problem with the ftp server admin. PHP has a whole slew of functions for working with ftp which you can probably find just by going to php.net and searching for ftp, they also have a whole section on handling file uploads too.

thanks very much kevindougans.. really appreciated.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.