Jump to content

cannot read form variable


thosecars82

Recommended Posts

Hello, do you have any idea to be able to read the send variable of the form?

Altough I browse a file, it still does not show anything in the echo marked with asterisks below.thks in advance

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

</head>

 

<body>

<?PHP

if ($_POST['send']) {

echo "upfile = ".$_POST['upfile'];// ********* I don't know why this line does not print the name of the //choosen upfile. It's

                              // as if the variable upfile of the form could not be readed. Moreover, the following if conditions

  //obviously cannot work until I solve this issue.

if ($_POST['upfile'] != "none" AND $_POST['upfile_size'] != 0){

echo "Name: ".$_POST['upfile_name']."<BR>\n";

echo "Size: ".$_POST['upfile_size']." <BR>\n";

echo "Type: ".$_POST['upfile_type']." <BR>\n";

 

// for Windows

if (! copy ($_POST['file'], "C:\\TEMP\\".$_POST['upfile_name'])) {

echo "<h2>File could not be copied</h2>\n";

}

 

/* for Linux/Unix

if (! copy ($_POST['file'], "/tmp/".$_POST['file_name'])) {

echo "<h2>File could not be copied</h2>\n";

}

} */

}

elseif (($_POST['upfile'] != "none") AND ($_POST['upfile_size'] == 0)) {

echo "<h2>File size exceded exceded</h2>\n";

}

else {

echo "<h2>You haven't choose a new file to upload</h2>\n";

}

echo "<HR>\n";

}

?>

<FORM ENCTYPE="multipart/form-data" ACTION="<?php echo $PHP_SELF ?>" METHOD="post">

<INPUT type="hidden" name="MAX_FILE_SIZE" value="100000">

<p><b>File to upload<b><br>

Example

<INPUT type="file" name="upfile" size="35"></p>

<p><INPUT type="submit" name="send" value="Accept"></p>

</FORM>

</body>

</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.