View Full Version : Uploading images

10-28-2003, 04:16 PM
I have a piece of code that I've used before to upload an image from a form to a specified folder, and it has worked fine.

copy($_FILES['img1']['tmp_name'], "images/userpics/".$_FILES['img1']['name']) or die("Couldn't copy the file!");

I need to use this again, but this time the folder into which the image is uploaded will depend on one of the options selected in the form. The user selects a category for the image and it is placed in the corresponding folder.

I've obtained the name of the folder from the form and it is stored in the variable $imgfolder. The code I have for the actual upload is as follows, but I am getting a failure on it.

copy($_FILES['imgfull']['tmp_name'], "images/".$imgfolder."/".$_FILES['imgfull']['name']) or die("Couldn't copy the file!");

Can anyone see what is wrong with this?

10-28-2003, 08:39 PM
whats the error ? , my crystal ball suggests "permission denied" (in which case you need to chmod the folders appropriately) but I dont believe in fortune tellers :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum