2011-01-10 122 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 ..... 
} 

因爲在服務器不是在登錄我重定向到的index.php

這SWFUpload的調試器窗口輸出

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?s ='189477fcfa1ec7f630e70a09e1e84cae'` - 這些單引號應該在那裏嗎? – thirtydot 2011-01-10 10:58:59

+0

我試過沒有和引號,同樣的問題 – Saqueib 2011-01-10 11:02:06

回答

0

在SWFUpload的JS試試這個:

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