upload application
Posted: Mon Jun 25, 2007 10:35 pm
hi, i have this code for my upload.
and the for is
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.
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.";
}
}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" />
<input type="submit" name="upload" value="Upload" class="FormButton" />
</form>