Page Loaded from javascript driving me nuts - no sessions or cookies?

Hi all,

I am having some problems with a multiple image upload script.

Page 1 = Sets 2 cookies, 1 with a name of a_id and one with a name of u_id (I have also stored these in sessions for testing.

Page 2, is a bit long!


Multiple File Upload With Progress Bar - Web Developer Plus Demos <?php session_start();?> #swfupload-control p{ font-size:0.9em; } #log{ margin:0; padding:0; width:220px;} #log li{ list-style-position:inside; margin:2px; border:1px solid #ccc; font-size:12px; font-family:Arial, Helvetica, sans-serif; color:#333; background:#fff; } #log li .progressbar{ border:1px solid #333; height:5px; background:#fff; width:200px } #log li .progress{ background:#999; width:0%; height:5px; } #log li p{ margin:0; line-height:18px; } #log li.success{ border:1px solid #339933; background:#fff; float:left; } #log li span.cancel{ position:absolute; top:5px; right:5px; width:20px; height:20px; background:url('jquery/swfupload/cancel.png') no-repeat; cursor:pointer; }
<h3><?php echo $_SESSION["a_name"];



    <?php if(isset($number)) { echo $number; }?>

    Page three is the bit which is causing me grief, it is loaded from the javascript on page 2

    upload_url: "upload-file.php",

    upload-file.php contains this:


    $uploaddir = ‘uploads/’;
    $file = $uploaddir . basename($_FILES[‘uploadfile’][‘name’]);
    echo “error file size > 10 MB”;
    if (move_uploaded_file($_FILES[‘uploadfile’][‘tmp_name’], $file)) {

    $uploadedfiles = ($_FILES);
    $files = $uploadedfiles;
    foreach($files as $value)
    $a_id = $_COOKIE[‘a_id’];
    $u_id = $_COOKIE[“u_id”];
    $insert = “INSERT INTO images (a_id, u_id) VALUES (’$a_id’, ‘$u_id’)”;

    mysql_query($insert) or die(mysql_error());
    echo “success”;

    else {
    echo “error “.$_FILES[‘uploadfile’][‘error’].” — “.$_FILES[‘uploadfile’][‘tmp_name’].” %%% “.$file.”($size)”;

    The problem is, these cookies are just not read, whenever a entry is made in the database, both a_id and u_id return 0


    Any Ideas?

    Sponsor our Newsletter | Privacy Policy | Terms of Service