Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Uploading files

  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    13
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Uploading files

    Ok, I've never dealt with uploading files at all, so I'm looking for some detailed help.

    What I want to do, is have a user be able to upload an image from their control panel, and it will be saved as their userid, which I already have in a variable, and will overwrite the previous image if it exists. I want to be able to restrict the image to an exact size, under a certain amount of KB, and it must be a png filetype.

  • #2
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    The PHP manual has a nice detailed section on handling file uploads, so start there. Once you get the hang of how file uploads work, you can layer on other functionality such as file type validation, checking the size, etc. It's relatively easy and trivial to use a naming convention like the user ID value as you've mentioned. Just remember that file permissions can get you into trouble when uploading files, so be sure you understand how your server PHP config and filesystem handles file perms.

  • #3
    Regular Coder
    Join Date
    May 2008
    Location
    Ohio
    Posts
    231
    Thanks
    3
    Thanked 21 Times in 21 Posts
    I like the tutorial at tizag: http://www.tizag.com/phpT/fileupload.php
    zok@zoklet:~$ whereis zok
    zok: http://zoklet.net | http://zoklet.net/otg | /derzok/at/gmail/dot/com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •