p80
11-21-2004, 11:23 AM
what's wrong with this script
$uploaddir = 'postimages/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
echo "Createing refrence file...\n";
$fileName = $_FILES['userfile']['name'];
setcookie('myImage', $fileName, time()+864000);
} else {
echo "File upload failed\n";
}
print_r($_FILES);
print "</pre>";
the error I get
Warning: Cannot modify header information - headers already sent by (output started at /home/partical/public_html/imgUpload.php:8) in /home/partical/public_html/imgUpload.php on line 13
line 13 is the cookie. the upload works fine, but I'm brain farting on the cookie. thanks
$uploaddir = 'postimages/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
echo "Createing refrence file...\n";
$fileName = $_FILES['userfile']['name'];
setcookie('myImage', $fileName, time()+864000);
} else {
echo "File upload failed\n";
}
print_r($_FILES);
print "</pre>";
the error I get
Warning: Cannot modify header information - headers already sent by (output started at /home/partical/public_html/imgUpload.php:8) in /home/partical/public_html/imgUpload.php on line 13
line 13 is the cookie. the upload works fine, but I'm brain farting on the cookie. thanks