把header( )移动到<?php 后面试试

解决方案 »

  1.   

    system("webtext ".substr($upload_file,2,strlen($upload_file)-2). " result.htm");
       header("Location: result.htm");出错用ob_start()就可以避免.但是这两句有个很大的问题,
    就是system调用后,webtext是作为一个独立进程运行,运行完成是需要一定时间的.
    随后header到该htm文件时,不能保证该文件已经完全生成
      

  2.   

    <?php
       header("Location: result.htm");
       $upload_dir = "./";
       $upload_file = $upload_dir.$_FILES["file1"]["name"];
       move_uploaded_file($_FILES["file1"]["tmp_name"],$upload_file);
       system("webtext ".substr($upload_file,2,strlen($upload_file)-2). " result.htm");
       ?>我照arrbo() 所說的可以~~ 想請問在linux 下要怎麼改??謝謝
      

  3.   

    ob_start();
    system("webtext ".substr($upload_file,2,strlen($upload_file)-2). " result.htm");
    on_end_clean();函数system是有输出的
      

  4.   

    linux 下出現<?php    $upload_dir = "./";
        $upload_file = $upload_dir.$_FILES["file1"]["name"];
        move_uploaded_file($_FILES["file1"]["tmp_name"],$upload_file);
        ob_start();
        system("webtext ".substr($upload_file,2,strlen($upload_file)-2). " result.htm");
        ob_end_clean();   
        header("Location: result.htm");
    ?>
    Warning: move_uploaded_file(./abc.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/2006u/u92510764/public_html/file/uploadonefile.php on line 5Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpKPmYng' to './abc.txt' in /home/2006u/u92510764/public_html/file/uploadonefile.php on line 5Warning: Cannot modify header information - headers already sent by (output started at /home/2006u/u92510764/public_html/file/uploadonefile.php:5) in /home/2006u/u92510764/public_html/file/uploadonefile.php on line 10如果把header("Location: result.htm");放到 <? 後面就完全不能跑~連錯誤訊息也沒有~~
    不過windows 下卻沒有問題@@ 怎麼會這樣?? <?php
      
      header("Location: result.htm");  
        $upload_dir = "./";
        $upload_file = $upload_dir.$_FILES["file1"]["name"];
        move_uploaded_file($_FILES["file1"]["tmp_name"],$upload_file);
        ob_start();
        system("webtext ".substr($upload_file,2,strlen($upload_file)-2). " result.htm");
        ob_end_clean();   
        
    ?>
      

  5.   

    我同樣的代碼在windows 上可以跑 , linux 就失敗@@還是linux path要修改???<?php   header("Location: result.htm");
       $upload_dir = "./";
       $upload_file = $upload_dir.$_FILES["file1"]["name"];
       move_uploaded_file($_FILES["file1"]["tmp_name"],$upload_file);
       ob_start();
       system("webtext ".substr($upload_file,2,strlen($upload_file)-2). " result.htm");
       ob_end_clean();
    ?>
      

  6.   

    還是不行~~我把資料放空間裡 我放了 windows & linux 兩種版本 
    問題應該是出在uploadonefile.php 裡面我現在是linux 版本有問題 , windows 可以正常運作http://cetus.cs.tku.edu.tw/~u92510764/file.zip
    謝謝
      

  7.   

    被上传的文件应该设置权限为777,然后再用
     move_uploaded_file()
    同样header()要移动到程序首行.
      

  8.   

    文件路径的权限是否为777
    用mkdir()试试
      

  9.   

    好複雜@@~~PHP 連結C 怎麼那麻煩@@~~ 
    <?php   header("Location: result.htm");
       $upload_dir = "./";   $upload_file = $upload_dir.$_FILES["file1"]["name"];
       move_uploaded_file($_FILES["file1"]["tmp_name"],$upload_file);
       ob_start();
       system("webtext ".substr($upload_file,2,strlen($upload_file)-2). " result.htm");
       ob_end_clean();
    ?>抱歉我PHP 不太會 
    mkdir();??? 加入代碼哪邊做測試???謝謝
      

  10.   

    你这个header不能移到第一行.
    你要等upload文件move到正确位置完才能转向到相应页面的加了ob_start,header放后面也不会出错.你现在的问题估计是linux的目录权限问题, 你用ftp工具查一下该目录的权限就行
      

  11.   

    我目錄改成777 
    header不能移到第一行@@~~ 有些人說要移到第一行 @@~~ <?php
      
       $upload_dir = "./";   $upload_file = $upload_dir.$_FILES["file1"]["name"];
       move_uploaded_file($_FILES["file1"]["tmp_name"],$upload_file);
       ob_start();
       system("webtext ".substr($upload_file,2,strlen($upload_file)-2). " result.htm");
       ob_end_clean();
        header("Location: result.htm"); // 移到最後面
    ?>helloyou0(你好!) 那我改成這樣OK嗎???
      

  12.   

    不過會出現Warning: Cannot modify header information - headers already sent by (output started at /home/2006u/u92510764/public_html/file/uploadonefile.php:3) in /home/2006u/u92510764/public_html/file/uploadonefile.php on line 10
    這錯誤訊息@@
      

  13.   

    确认<?php之前没有任何其它字符包括空格空行及不可见字符
    就是说<必须是第一行第一个字符再试再报
      

  14.   

    helloyou0(你好!)
    你的方法我試過ㄌ還是不可以@@~~ 頭痛@@~~
    我傳短訊把我
    linux 主機地址(IP) 
    帳號
    密碼 文件都在 /var/www/file 裡面傳給你ㄌ
    我發短訊給你~~ 麻煩收一下謝謝