...

View Full Version : Uploading files



Auax
05-10-2009, 04:02 AM
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.

bdl
05-10-2009, 04:24 AM
The PHP manual has a nice detailed section on handling file uploads (http://us2.php.net/manual/en/features.file-upload.php), 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.

derzok
05-10-2009, 06:51 AM
I like the tutorial at tizag: http://www.tizag.com/phpT/fileupload.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum