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!
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['image']['name']);
if(move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) {
echo "Your file upload was successful.";
} else{
echo "<b>ATTENTION:</b> There was an error uploading your file.";
}
It uploads fine, I just don't want too much code. I need it to take a file like, "MyDocument.jpg" and change it to "010809_MyDocument.jpg", when the order number is 010809, etc.
It is a simple matter of prepending the order name to your $target_path. You didn't specify where the order number comes from, so for the sake of this example I've hardcoded it.
I would be more cautious. This situation can totaly destroy a project if someone load *.php file. He/She get full control of your site. I recomend to check file extension before uploading or create special .htaccess file to prevent this type of attack.