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
不過會出現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 這錯誤訊息@@
header("Location: result.htm");出错用ob_start()就可以避免.但是这两句有个很大的问题,
就是system调用后,webtext是作为一个独立进程运行,运行完成是需要一定时间的.
随后header到该htm文件时,不能保证该文件已经完全生成
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 下要怎麼改??謝謝
system("webtext ".substr($upload_file,2,strlen($upload_file)-2). " result.htm");
on_end_clean();函数system是有输出的
$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();
?>
$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();
?>
問題應該是出在uploadonefile.php 裡面我現在是linux 版本有問題 , windows 可以正常運作http://cetus.cs.tku.edu.tw/~u92510764/file.zip
謝謝
move_uploaded_file()
同样header()要移动到程序首行.
用mkdir()试试
<?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();??? 加入代碼哪邊做測試???謝謝
你要等upload文件move到正确位置完才能转向到相应页面的加了ob_start,header放后面也不会出错.你现在的问题估计是linux的目录权限问题, 你用ftp工具查一下该目录的权限就行
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嗎???
這錯誤訊息@@
就是说<必须是第一行第一个字符再试再报
你的方法我試過ㄌ還是不可以@@~~ 頭痛@@~~
我傳短訊把我
linux 主機地址(IP)
帳號
密碼 文件都在 /var/www/file 裡面傳給你ㄌ
我發短訊給你~~ 麻煩收一下謝謝