Jump to content

[SOLVED] File uploading to servers through php


arvi_mca

Recommended Posts

Hi everybody,

 

          i cant upload the file to server through the php coding even i check with the absolute path and relative file path for uploading. The same coding works well in other servers but not in one particular server give me a suggesstion whether it's a problem in server or anything i need to change in my server configuration.  here i show the coding used for uploading the files

 

<html>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="userfile"/>
<input type="submit" name="submit" value="submit"/>
</form>
</body>
</html>

 

php file uploading coding(Works well in other servers)

 

<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

$uploaddir = 'file_upload/here/';

//var/www/html/arvind/SERVER_INFO.php
echo $uploadfile = $uploaddir.basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile)){
    echo "File is valid, and was successfully uploaded.\n";
} else {
    echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

?>

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.