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!
$linktopic = $_FILES['uploadedfile']['name'];
// Where the file is going to be placed
$target_path = "/home/muot/public_html/pages/muotreport/submitted/";
/* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
// This is how we will get the temporary file...
$_FILES['uploadedfile']['tmp_name'];
$target_path = "/home/muot/public_html/pages/muotreport/submitted/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{
echo "S";
} else{
echo "E";
}
I need to be able to add to the name or change the name of the picture. I know there is a way to change the name in that script, i just dont want to mess anything up.
<?php
//Where the file is going to be placed
$uploaddir = "uploads/";
//Set the target for the file to be uploaded to
$target = $uploaddir . $_POST['newfilename'];
//Upload the file
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target)) {
echo 'File uploaded.';
} else {
echo 'File upload error.';
}
?>
Obviously some sort of validation should be added to the processing script but I've just given you the basics.