Из файла upload.html методом post передаётся переменная-файл.
При включенном register_globals=On (php.ini) данный код работает!!!
Как заставить код работать без этой директивы? Всё время получаю "No File Specified". Имя переменной img1
/var/www/upload.html
-------------------------------------------------------------
<HTML>
<HEAD>
<!-- <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1"> -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=UTF-8">
<META NAME="GENERATOR" Content="Visual Page 2.0 for Windows">
<TITLE>Virtual PHP File Uploader v1.0</TITLE>
</HEAD>
<BODY>
<FORM ACTION="upload.php" method="post" ENCTYPE="multipart/form-data">
<P>
<CENTER>
<P>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="36%" HEIGHT="80">
<TR>
<TD HEIGHT="20" COLSPAN="3" BGCOLOR="#0268A6"> </TD>
</TR>
<TR>
<TD HEIGHT="20" COLSPAN="3" BGCOLOR="silver">
<P ALIGN="CENTER"><B><FONT FACE="Verdana">Upload A File</FONT></B>
</TD>
</TR>
<TR>
<TD WIDTH="6%" HEIGHT="67" BGCOLOR="silver"> </TD>
<TD WIDTH="88%" HEIGHT="67" BGCOLOR="silver">
<P ALIGN="CENTER"> <INPUT TYPE="file" NAME="img1" SIZE="30">
</TD>
<TD WIDTH="6%" HEIGHT="67" BGCOLOR="silver"> </TD>
</TR>
<TR>
<TD HEIGHT="54" COLSPAN="3" BGCOLOR="silver">
<CENTER>
<P><INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Upload File">
</CENTER>
</TD>
</TR>
<TR>
<TD WIDTH="6%" BGCOLOR="#0268A6"> </TD>
<TD WIDTH="88%" BGCOLOR="#0268A6">
<P ALIGN="CENTER"><A HREF="http://www.mail.ru" target="_blank"><FONT SIZE="2" COLOR="white"
FACE="Verdana">Virtual
File Uploader v1.0</FONT></A>
</TD>
<TD WIDTH="6%" BGCOLOR="#0268A6"> </TD>
</TR>
</TABLE>
</CENTER>
<P>
</FORM>
</BODY>
</HTML>
-------------------------------------------------------------------
upload.php
-------------------------------------
<?php
echo "TUT BUDET PUSTO: ".$_POST['img1'];
echo "<br>";
echo "TUT TOZHE BUDET PUSTO:".$_HTTP_POST_VARS['img1'];
echo "<br>";
if ($img1_name!="") {
@copy("$img1" , ".//upload//$img1_name")
or die("Couldn't Upload Your File.");
} else {
die("No File Specified");
}
?>
----------------
Apache Version Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.5 with Suhosin-Patch
PHP Version 5.2.6-3ubuntu4.5
This server is protected with the Suhosin Patch 0.9.6.2
Copyright (c) 2006 Hardened-PHP Project