upload application

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

upload application

Post by pleigh »

hi, i have this code for my upload.

Code: Select all

if (isset($_POST['upload'])) {
	$target = "uploads/";	
	$target .= $_FILES['uploaded']['name'];
	$ok=1;
	if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
	{
		echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
	}
	else {//if(!$_FILES['uploaded']) {
		echo "Sorry, there was a problem uploading your file.";
	}
}
and the for is

Code: Select all

<form enctype="multipart/form-data" action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
Please choose a file: <input name="uploaded" type="file" class="FormButton" />&nbsp;
<input type="submit" name="upload" value="Upload" class="FormButton" />
</form>
and i was wondering what's going wrong. i have a windows box and when i tried to upload an application in the "uploads/" directory, i was able to upload the applications successfully. but when i upload the php file to a remote server, which is a linux box, i cant upload anything in the "uploads/" directory. i tried to remove the "/" and the upload is successful. but the application went to the directory where the upload.php page is.please help or advise mo on what to do. i just want the applications to be uploaded in the "uploads/" directory.thank you in advance.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Verify the path and permissions.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply