Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Session Problem...
  • Great script and it is working fine; but I have one problem with sessions.

    I am building a video community for a client - so big video files must be uploaded (best way with progressbar).
    I am using this structure: A main php site (session start), in an iframe a little php (with session start) which includes the uploadify code and the button and so on...the complete uploadigy script is in an folder an the server.
    I used the FAQ Example for sessions. (But I use the old Uploadify from the samples zip...the 2.1.4 does not work on my server at all, dont know why but the ones in the samples lib are running).

    Task is: I need the UploadFile name in a session for the video converting script!

    In Internet Explorer everything works fine - Every page has the same session id and I can shoot with the uploadify onComplete to my video converting php - getting all session names I declared in the upload.php from uploadify.

    I tested it in firefox and safari - both browsers generate a different session ID for the upload.php...and so all data cant be used in the following scripts.

    I dont know what to do, maybe you can help please??

    My Code:


    <? session_start();
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml"&gt;
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Uploadify scriptData Sample</title>

    <link rel="stylesheet" href="uploadify/uploadify.css" type="text/css" />

    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.uploadify.js"></script>

    <script type="text/javascript">

    $(document).ready(function() {
    $("#fileUpload").fileUpload({
    'uploader': 'uploadify/uploader.swf',
    'cancelImg': 'uploadify/cancel.png',
    'script': 'uploadify/upload.php',
    'folder': '../vimp/uploads/',
    'multi': false,
    'displayData': 'speed',
    'auto': true,
    'fileDesc' : 'Videodateien (.mov, .avi, .wmv, .rm, .mp4, .mpg, .flv)',
    'fileExt' : '*.mov;*.avi;*.mp4;*.flv;*.rm;*.mpg;*.wmv',
    'removeCompleted' : false,

    'scriptData': { 'session': '&lt;?php echo session_id();?&gt;'},

    'onComplete': function(event, data, queueID, fileObj, response) {top.location.href='http://www.talentchip.de/upload2.php'}

    });


    });

    </script>
    </head>

    <body>

    <div id="fileUpload">You have a problem with your javascript</div>


    </body>
    </html>


    and:

    <?php

    if ($_REQUEST['session']) session_id($_REQUEST['session']);
    session_start();
    $_SESSION["videoname"] = "";

    // JQuery File Upload Plugin v1.4.1 by RonnieSan - (C)2009 Ronnie Garcia
    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $vidfile_id = md5($_FILES["Filedata"]["tmp_name"] + rand()*100000);
    $extension = ".".array_pop(explode(".", $_FILES["Filedata"]["name"]));
    $videokon = $vidfile_id.$extension;

    // Uncomment the following line if you want to make the directory if it doesn't exist
    // mkdir(str_replace('//','/',$targetPath), 0755, true);

    move_uploaded_file($tempFile,$videokon);
    mail('info@webdesign-freren.de','Ein neues Video hochgeladen',$videokon.session_id());
    $_SESSION["videoname"] = $videokon;
    $_SESSION["videobytes"] = $_FILES['Filedata']['size'];
    $_SESSION["videoformat"] = $extension;
    }

    echo '1';

    ?>