问题描述
好吧,我看了一下这个小组的一个例子,试了一下,并试图用
使用它 - 但是当我在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
推荐答案
这篇关于新上传文件...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!