PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?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");
var_dump returns string(9) "phpARIf3f"
How can I grab the actual filename and automatically assign it to $name?
Thank you
Last edited by PastorHank on Thu Oct 18, 2007 10:13 pm, edited 1 time in total.