Renaming Picture, or adding to the name.
Posted: Wed Jan 25, 2006 3:55 pm
I have a picture upload script.
The form:
The processor:
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.
Thanks!
The form:
Code: Select all
<form action=picture.php method=post>
<input type="file" name=uploadedfile>
<inpu type=submit>
</form>The processor:
Code: Select all
$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";
}Thanks!