[英]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.