新上传文件... [英] new to uploading files...

查看:60
本文介绍了新上传文件...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我看了一下这个小组的一个例子,试了一下,并试图用
使用它 - 但是当我在PHP4中这样做时它不起作用。


< table>

< tr>< td>< input type =" file"名称= QUOT; newfile中" size =" 25">< / td>< / tr>

< tr>< td>< input type =" submit"命名= QUOT; sub_new" value =" Upload">< / td>< /

tr>

< / table>< / form>


并在同一档案中,但更早:


if($ _ POST [" sub_new"]!="")

{

print"< pre>" ;;

print_r($ HTTP_POST_FILES);

echo" Uploading:" ;

echo $ HTTP_POST_FILES [''newfile''] [''name''];

$ file = strtolower($ HTTP_POST_FILES [''newfile''] [ ''name'']);

$ uploadfile =" ../ somwhere /"。$ file;

echo $ uploadfile;

if(move_uploaded_file($ HTTP_POST_FILES [''newfile''] [''tmp_name''],

$ uploadfile))

echo"< font color = \" blue \"> $ file上传。< / font>< p>" ;;

}


我我永远无法获得文件名...为​​什么?


/ S

Well, I looked at an example from this group, tried it, and tried to
use it - but it does not work when I do it like this in PHP4.

<table>
<tr><td><input type="file" name="newfile" size="25"></td></tr>
<tr><td><input type="submit" name="sub_new" value="Upload"></td></
tr>
</table></form>

and in the same file, but ealier:

if($_POST["sub_new"]!="")
{
print "<pre>";
print_r($HTTP_POST_FILES);
echo "Uploading: ";
echo $HTTP_POST_FILES[''newfile''][''name''];
$file=strtolower($HTTP_POST_FILES[''newfile''][''name'']);
$uploadfile = "../somwhere/".$file;
echo $uploadfile;
if (move_uploaded_file($HTTP_POST_FILES[''newfile''][''tmp_name''],
$uploadfile))
echo "<font color=\"blue\">$file uploaded.</font><p>";
}

I am never able to get the filename... why?

/S

推荐答案

_POST [&曲ot; sub_new"]!="")

{

print"< pre>" ;;

print_r(
_POST["sub_new"]!="")
{
print "<pre>";
print_r(


HTTP_POST_FILES);

echo" Uploading:";

echo
HTTP_POST_FILES);
echo "Uploading: ";
echo


HTTP_POST_FILES [''newfile''] [''name''];
HTTP_POST_FILES[''newfile''][''name''];


这篇关于新上传文件...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆