The following is the partial source for an upload form.. I'm having trouble with the mail() function including the actual file name the user is sending instead of "/tmp/phpIkRjHq"..
I understand that PHP will retain the file in a temporary directory (/tmp/) until it is stored to the path I've specified (/uploaded/), but I don't understand how to get it to print the new file name within the email it sends to me.. Currently, it only prints the temporary file name as shown above.. As you can see, to the last $body variable, I've added both $info & $file as a test, but $info returns null and $file returns the temp path/name only.. However, within the returned php/html page, the $file variable actually does echo the actual file name the user chose to upload.. I'm a newbie, so hopefully I'm making sense.. Any ideas to help me fix this problem would be appreciated.. Thanks in advance.. Take care.. peace.. eriol ==== <----SNIP----> <? $uppath = "/uploaded/"; $uptime = $uptime = date("mdy@his--"); $body = "The following information was submitted from $SERVER_NAME..\n\n"; $body .= $info ."\n\n". $file; $info = NULL; if(count($_FILES) > 0){ $allowed_types = array("text/plain","text/html"); $size_limit = "524288"; $file = $_FILES["file"]["name"]; $type = $_FILES["file"]["type"]; $size = $_FILES["file"]["size"]; $temp = $_FILES["file"]["tmp_name"]; $path_info = pathinfo($PATH_TRANSLATED); $write_path = $path_info["dirname"] . "$uppath$uptime" . $file; if ($file){ if ($size < $size_limit){ if (in_array($type,$allowed_types)){ if(move_uploaded_file($temp,$write_path)){ $info = "<font class=\"s\"><tt>$file</tt> has been uploaded successfully..</font>"; if(!mail($email,$subject,$body,"Return-Path: <me@$SERVER_NAME>\r\n" ."From: me <me@$SERVER_NAME>\r\n" ."Reply-To: me@$SERVER_NAME\n" ."X-Mailer: $SERVER_NAME")){ echo "uh.."; } .... a few else statements ... } } ?> <html> <body> <?php echo $info ?> <form enctype="multipart/form-data" action="<?php echo $PHP_SELF ?>" method="POST"> Upload: <input name="file" type="file"> <input type="submit" value="Upload"> </form> </body> </html> <----/SNIP----> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php