亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1502 | 回復: 7
打印 上一主題 下一主題

[文件上傳] 關于上傳文件的問題(疑問....) [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2006-06-02 21:23 |只看該作者 |倒序瀏覽
我看到論壇上也有人問過這樣的問題!我也有類似的問題。。≡诰W上搜索找到的程序也是類似與手冊上的。!
我用的是fc4
我按照手冊上的程序來做!
<?php
// 在 4.1.0 以前的 PHP 中,需要用 $HTTP_POST_FILES 代替 $_FILES。
// 在 4.0.3 以前的 PHP 中,需要用 copy() 和 is_uploaded_file() 來代替 move_uploaded_file()。

$uploaddir = '/var/www/upload/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) {
    print "File is valid, and was successfully uploaded.  Here's some more debugging info:\n";
    print_r($_FILES);
} else {
    print "Possible file upload attack!  Here's some debugging info:\n";
    print_r($_FILES);
}
print "</pre>";
?>

上傳的的目錄/var/www/upload 我都設置了全部權限 (r-w-x- r-w-x- r-w-x)

但是在瀏覽器會顯示這樣的信息:
Possible file upload attack!  Here's some debugging info:
Array
(
    [uploadfile] => Array
        (
            [name] => aaa.txt
            [type] => text/plain
            [tmp_name] => /tmp/phpYQr90B
            [error] => 0
            [size] => 151
        )

)
請CU的各位大俠幫幫小弟~不勝感激~

[ 本帖最后由 HonestQiao 于 2006-6-2 21:25 編輯 ]

論壇徽章:
1
技術圖書徽章
日期:2013-12-05 23:25:45
2 [報告]
發(fā)表于 2006-06-02 21:29 |只看該作者
<?php
// 在 4.1.0 以前的 PHP 中,需要用 $HTTP_POST_FILES 代替 $_FILES。
// 在 4.0.3 以前的 PHP 中,需要用 copy() 和 is_uploaded_file() 來代替 move_uploaded_file()。

$uploaddir = '/var/www/upload/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
print "<pre>";
if (!is_writable($uploaddir))
{
    print "Directory is writable false.";
}
else
{
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
        print "File is valid, and was successfully uploaded.  Here's some more debugging info:\n";
        print_r($_FILES);
    } else {
        print "Possible file upload attack!  Here's some debugging info:\n";
        print_r($_FILES);
    }
}
print "</pre>";
?>

論壇徽章:
0
3 [報告]
發(fā)表于 2006-06-02 21:31 |只看該作者
補充一下:
上傳文件的表單里已經設置了
<form method="post" action="upload.php" enctype="multipart/form-data">
請問什么原因造成上面的程序上傳不了文件?
如果哪位大俠有經過試驗可以上傳文件的程序,可否貼個出來讓小弟參考參考??..非常感謝~~~

論壇徽章:
0
4 [報告]
發(fā)表于 2006-06-02 21:48 |只看該作者
謝謝版主回答~~
可是還是顯示跟以前一樣的信息:
ossible file upload attack!  Here's some debugging info:
Array
(
    [uploadfile] => Array
        (
            [name] => aaa.txt
            [type] => text/plain
            [tmp_name] => /tmp/phpKi1vFf
            [error] => 0
            [size] => 151
        )

)
非常奇怪啊~~~~~

論壇徽章:
1
技術圖書徽章
日期:2013-12-05 23:25:45
5 [報告]
發(fā)表于 2006-06-02 21:52 |只看該作者
error_reporting(E_ALL);

實在不行把那個操作系統卸載換windows或者freebsd

論壇徽章:
0
6 [報告]
發(fā)表于 2006-06-02 22:06 |只看該作者
我的php.ini的 error_reporting= E_ALL
暈~~我的同學在window就可以上傳到文件...
我剛才也在FC5也試過...也是那樣子~~難道是linux操作系統的問題嗎?
anyway 非常感謝版主的回答~~~~~~

論壇徽章:
1
技術圖書徽章
日期:2013-12-05 23:25:45
7 [報告]
發(fā)表于 2006-06-02 22:07 |只看該作者
你有沒有看設置什么open_basedir或者什么selinux啊

論壇徽章:
0
8 [報告]
發(fā)表于 2006-06-03 09:40 |只看該作者
在我的那個php.ini找到關于open_basaedir的一段
; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
;open_basedir =
--------------------------------------------------------------------

file uploads的設置:
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

至于版主您所說的那個selinux就找不到。。。
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯網協會會員  聯系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP