basename returning unusual value <SOLVED>
Posted: Thu Oct 18, 2007 9:23 pm
I have a form where I gather a filename which has the complete path. I then upload the file using the following
var_dump returns string(9) "phpARIf3f"
How can I grab the actual filename and automatically assign it to $name?
Thank you
Code: Select all
<?php
define ("FILEREPOSITORY","../stories");
if (is_uploaded_file($_FILES['classnotes']['tmp_name'])) {
if ($_FILES['classnotes']['type'] != "application/pdf") {
echo "<p>Notes must be uploaded in PDF format.</p>";
} else {
/* I am trying to avoid having the user re-enter the filename *?
/* if they manually enter the target filename on the form $name works fine */
$name = $_POST['name'];
/* */
$captiontouse = $_POST['captionforfile'];
$testname=basename($_FILES['classnotes']['tmp_name']) ;
var_dump($testname);
$result = move_uploaded_file($_FILES['classnotes']['tmp_name'], FILEREPOSITORY."/$name.pdf");How can I grab the actual filename and automatically assign it to $name?
Thank you