Basically I just have a static HTML file with my BrowserPlus javascript at the end of it. I have tried various methods but currently I call a PHP script that sets the cookie. The upload works, but just not the cookie part.
The call from the html to the cookie setting php:
<script language="javascript" src="settimestampcookie.php"> </script>
The cookie setting script:
<?php
//use time stamp for unique identification
$timestamp = time();
if($timestamp != null)
{
//Create cookie
setcookie('csocookie', $timestamp);
}
?>
The function that calls the PHP uploader (almost identical to the zipper/uploader example:
function uploadInputFiles(e)
{
elFile.innerHTML ="Uploading...";
elZip.innerHTML = "";
if (ZippedFiles != null)
{
BrowserPlus.Uploader.upload(
{
url: "inputupload.php",
files: {"file": ZippedFiles}
},
function(res)
{
if (res.success)
{
elFile.innerHTML ="Uploaded of Folder 1 Successful! Please continue to step 2.";
elZip.innerHTML = res.value.body;
}
else
{
elZip.innerHTML = "ERROR: " + res.error;
}
});
}
return false;
}
Before the user pushes the upload button I can see the cookie from the browser. But when the following upload script runs, it sees no cookies.
<?php
//Get the cookie
if (isset($_COOKIE['csocookie']))
{
$timestamp = $_COOKIE['csocookie'];
}
else
{
$timestamp = $_POST['timestamp'];
}
echo "timestamp = " . $timestamp;
uploads the file, etc....
?>