簡體   English   中英

PHP會話不通過文件

[英]PHP session doesn't pass through files

我正在為腳本使用Uploadify。

主頁:

<?php

session_start();

var_dump($_SESSION);
$uploaded_files = $_SESSION['uploaded_files'];

?>

//Uploadify, HTML forms and more (not related, No PHP in this section)

uploadify.php:

<?php

session_start();

require_once('includes/functions.php');

// Define a destination
$targetFolder = 'uploads/temp'; // Relative to the root

if (!empty($_FILES)) {
    $fileParts = pathinfo($_FILES['Filedata']['name']);
    $file_hash = GenRndStr(20) . '.' . $fileParts['extension'];
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $targetFolder;
    $targetFile = rtrim($targetPath,'/') . '/' . $file_hash;

    // Validate the file type
    $fileTypes = array(); // File extensions

    move_uploaded_file($tempFile, $targetFile);
    $_SESSION['uploaded_files'][] = $file_hash;
    echo '1';
}

?>

我確定它到達$_SESSION['uploaded_files'][] = $file_hash; 部分,因為實際文件已上傳到目錄。 我的問題是$_SESSION['uploaded_files']var_dump返回null。

這些文件位於同一目錄級別。

提前致謝。

我找到了解決方案。 問題在於,Uploadify的Flash版本被視為服務器的其他客戶端,因此服務器為其創建了新的會話ID。

我遵循了以下主題: http : //www.uploadify.com/forum/#/discussion/43希望它會對他人有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM