Hi,
I've writing a small upload script and in the form i'm using the action="$PHP_SELF"
this caused warning: undefined variable php_self in file at line x to show up so i've tried moving the form out of my php and using action="<?PHP echo $PHP_SELF ?>"
this just puts nothing there so i end up with source of action=""
heres the full code:
<?PHP
if(isset($userfile))
upload_file();
function upload_file(){
// In PHP 4.1.0 or later, $_FILES should be used instead of $HTTP_POST_FILES.
if (is_uploaded_file($HTTP_POST_FILES['userfile'])) {
copy($HTTP_POST_FILES['userfile']['tmp_name'], "./place/to/put/uploaded/file");
} else {
die("ERROR: upload of".$HTTP_POST_FILES['userfile']['name']." Failed.");
}
/ ...or... /
//move_uploaded_file($HTTP_POST_FILES['userfile'], "/place/to/put/uploaded/file");
}
?>
<form enctype="multipart/form-data" method="post" action="<?PHP echo $PHP_SELF?>">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
help please?