formData 옵션을 통해 세션 데이터를 전달하기위한 uploadify (v3.1)의 해결 방법에 다소 어려움이 있습니다. this page에 대한 제안을 구현했지만 HTTP 500 오류가 발생합니다.세션 변수가 uploadify.php로 전달되는지 여부를 어떻게 확인할 수 있습니까?
내 세션의 내용을 확인하고 해결 방법이 실제로 작동하는지 (예 : 내 세션 ID가 실제로 uploadify.php로 전달되는지 확인하는 방법) 궁금합니다. uploadify.php에 에코 된 변수를 반환하는 일반적인 방법은 onUploadSuccess 이벤트이지만, 업로드가 성공적으로 완료되지 않았으므로 사용할 수 없습니다!
그래서 다른 옵션이 있는지 궁금합니다. var_dump($_SESSION);
또는 die(print($_SESSION));
과 같은 방법을 알고 있지만이 정보가 어디에서 반환되는지 찾아야할지 모르겠습니다.
도움이 될 수 있도록 아래에 전체 uploadify.php 스크립트가 포함되어 있습니다.
감사합니다,
닉
<?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>
*/
// 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.';
}
}
?>
은'위해서 var_dump ($ _ SESSION) 후 사용 기억하십시오. 유효한 세션은'session_start();'다음에 존재합니다. – GodLesZ
'session_start(); 뒤에'var_dump ($ _SESSION);을 추가하십시오. – Elen
고마워요. 'session_start();'다음에'var_dump ($ _SESSION);'을 포함 시켰지만 리턴 된 것을 어디서 읽을 것인지 모르겠습니다. uploadify.php는 내 index.php 페이지에서 uploadfify 스크립트에 의해 호출되지만, uploadify.php가 호출 된 후에도 index.php 페이지에 변수 덤프가 표시되지 않습니다! – Nick