2011-01-10 2 views
0

swfupload에 문제가 있습니다. 이처럼 session_id()를 전달하고 있습니다.swfupload 세션 문제가 세션을 파괴합니다.

참고 : 내 로컬 컴퓨터에서 제대로 작동합니다. MAMP를 사용하고 있습니다. 하지만 서버

/upload-file.php?s='<?php echo session_id()'; 
    /upload-file.php?s=189477fcfa1ec7f630e70a09e1e84cae 

하지만 유지하지 세션에서 일하는 내 현재의 세션을 파괴하지 (나 로그 아웃) 여기에 파일 업로드 코드입니다.

<?php 

if(isset($_GET['s'])) { 

session_id($_GET['s']); 
session_start(); 

    require_once 'admin/class/user.php'; 

    $u = new User(); 

    //Check for user logged in 

    if($u->islogged() == FALSE) { 

     header("location: index.php"); 

    exit(); 

    code continue ..... 
} 

서버에 로그인하지 않은이기 때문에 나이가 swfupload있는 index.php를

디버거 창 출력

SWF DEBUG: ----- END SWF DEBUG OUTPUT ---- 
SWF DEBUG: 
SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.jpg 
SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list... 
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0 
SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1 
SWF DEBUG: StartUpload: First file in queue 
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0 
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to /upload-file.php?s='189477fcfa1ec7f630e70a09e1e84cae' for File ID: SWFUpload_0_0 
SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0 
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 317793. Total: 317793 
SWF DEBUG: Event: uploadError: HTTP ERROR : File ID: SWFUpload_0_0. HTTP Status: 302. 
SWF DEBUG: Event: uploadComplete : Upload cycle complete. 
SWF DEBUG: StartUpload: First file in queue 
SWF DEBUG: StartUpload(): No files found in the queue. 
+0

'/upload-file.php에 업로드를 시작 하시겠습니까? '='189477fcfa1ec7f630e70a09e1e84cae'' - 그 작은 따옴표가 있어야합니까? – thirtydot

+0

따옴표없이 동일한 문제를 시도 했으니 – Saqueib

답변

0

로 리디렉션하여 swfupload의 JS이 시도 :

var swf; 
    window.onload = function() { 
    swf = new SWFUpload({ 
    // Backend Settings 
    post_params: {"PHPSESSID": "<?php echo session_id(); ?>"} 
... 
+0

내 컴퓨터에서 내 스크립트가 제대로 작동하고 있으며 MAMP와 잘 작동하고 있습니다. 하지만 그 서버에서 작동하지 않습니다 – Saqueib

+0

어이 형제 그게 아무것도 작동하지 않습니다 – Saqueib

+0

그냥 기본적인 멍한 생각. 업로드하기 전에 토큰을 설정하고 숨겨진 양식 필드에 토큰을 설정하고 보내기 전에 세션 ID를 db로 저장하십시오. 다음 단계에서 숨겨진 양식 필드를 가져 와서 데이터베이스에 대해 확인하십시오. 해당 토큰의 세션 ID를 가져 와서 복원하십시오 :) 작동해야합니다. – Diablo