How to check if session variables are passed to uploadify.php?

I'm having difficulty with the workaround method in uploadify (v3.1) to pass session data through the formData parameter. I have implemented a suggestion for this page , but I get an HTTP 500 error message.

I am wondering how to check what is in my session to make sure the workaround really works, i.e. if my session id is really passed uploadize.php. The usual method for returning variables, echoing in uploadify.php, is the onUploadSuccess event, but I cannot use this since the download does not complete successfully!

So I wonder what other options I have. I know methods like var_dump( $_SESSION );or die(print($_SESSION));, but I don't know where to look for the information they return.

I include the full uploadify.php script file below, if useful.

Thank,

Nick

<?php
$session_name = session_name();

if (!isset($_POST[$session_name])) {
    exit;
} else {
    session_id($_POST[$session_name]);
    session_start();
}

/*
Uploadify
Copyright (c) 2012 Reactive Apps, Ronnie Garcia
Released under the MIT License <http://www.opensource.org/licenses/mit-license.php&gt; 
*/
// Define a destination
$targetPath = 'media/' . $_SESSION["user_name"] . '/';

if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetFile = $targetPath . $_FILES['Filedata']['name'];

    // Validate the file type
    $fileTypes = array('jpg','jpeg','gif','png'); // File extensions
    $fileParts = pathinfo($_FILES['Filedata']['name']);

    if (in_array($fileParts['extension'],$fileTypes)) {
        move_uploaded_file($tempFile,$targetFile);
        echo '1';
    } else {
        echo 'Invalid file type.';
    }
}

?>
0
source share
1 answer

You can also use print_r($_SESSION), but var_dump($_SESSION)also useful.

Remember that you only use session_start();

0
source

All Articles