Hello. I am developing an image hosting site. You can upload multiple files at once. No registration is required in this site so I have found ways of tracking who uploaded which file. One of them is via cookies. Now the code is like this:
-------------
while ($i < $numberOfFiles) {
move_uploaded_file($_FILES["file" . $i]["tmp_name"], "img/" . $_FILES["file" . $i]["name"]);
$sql = mysql_query("INSERT INTO img (name, size, uploaderip, uploaderid, cat) VALUES ('$fRName', '$fSize', '$fUploaderIP', '$fUploaderID', '$fCat')");
if (!isset($_COOKIES["total"]))
setcookie("total", "0", time()+60*60*24*30*12*10);
$_COOKIE["total"]++;
setcookie("total", $_COOKIE["total"], time()+60*60*24*30*12*10);
setcookie("image[" . $_COOKIE["total"] . "]", $fRName, time()+60*60*24*30*12*10);
-----------------
now the problem here is I get "header already sent" error when trying to upload multiple files. One file is always OK but when I try multiple ones I get this error. Is there an easy way of doing this? THanks for help.
-------------
while ($i < $numberOfFiles) {
move_uploaded_file($_FILES["file" . $i]["tmp_name"], "img/" . $_FILES["file" . $i]["name"]);
$sql = mysql_query("INSERT INTO img (name, size, uploaderip, uploaderid, cat) VALUES ('$fRName', '$fSize', '$fUploaderIP', '$fUploaderID', '$fCat')");
if (!isset($_COOKIES["total"]))
setcookie("total", "0", time()+60*60*24*30*12*10);
$_COOKIE["total"]++;
setcookie("total", $_COOKIE["total"], time()+60*60*24*30*12*10);
setcookie("image[" . $_COOKIE["total"] . "]", $fRName, time()+60*60*24*30*12*10);
-----------------
now the problem here is I get "header already sent" error when trying to upload multiple files. One file is always OK but when I try multiple ones I get this error. Is there an easy way of doing this? THanks for help.
