uploading help please again

From: Date: Mon, 04 Nov 2002 01:31:47 +0000
Subject: uploading help please again
Groups: php.general 
Request: Send a blank email to php-general+get-122592@lists.php.net to get a copy of this message
Ok I'm back This script is to upload 2 image files Whit register_globals = on it Works fine script A "p.php" <title>Jornal O Leme</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#006699"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="100%" height="70" valign="top"><img src="test.jpg" width="600" height="120"> </td> </tr> <tr> <td height="262" valign="top"><p>&nbsp;</p> <form method="post" action="pi.php" enctype="multipart/form-data"> <table width="75%" border="0" align="center" bgcolor="#FFFFFF"> <tr> <td width="23%"><div align="center"><font face="BankGothic Md BT"> </font></div></td> <td width="77%" bgcolor="#FFFFFF">&nbsp; </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF">&nbsp; </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF">&nbsp; </td> </tr> <tr> <td><div align="left"><strong>Imagem pequena</strong></div></td> <td bgcolor="#FFFFFF"> <input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem"> </td> </tr> <tr> <td><div align="left"><strong>Imagem grande</strong></div></td> <td bgcolor="#FFFFFF"><input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem2"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF">&nbsp; </td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </table> <p align="center"> <input name="submit" type="submit" value="Adicionar"> <input type="hidden" name="page" value="inserir1"> </form></p> </td> </tr> <tr> <td height="81" valign="top"><div align="center"> <p>&nbsp;</p> <p> <?php include ('menu.php'); ?> &nbsp;</p> </div></td> </tr> </table> ---------------------------------------------------------------------------- ------------------------ "pi.php" echo $page; ---> returns inserir1 _correct echo $origem; ---> returns the temp path of the file _correct set_time_limit(60); $path=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem_name="fdx.jpg"; $dest= $path.$origem_name; if (($origem <> "none") && ($origem <> "")){ if (copy($origem,$dest)){; } else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem); } set_time_limit(60); $path2=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem2_name="porra.jpg"; $dest2= $path2.$origem2_name; //printf("$path"); //printf("<br>"); //printf("$origem_name"); if (($origem2 <> "none") && ($origem2 <> "")){ if (copy($origem2,$dest2)){; //echo "<br>upload do ficheiro $origem_name efectuada com sucesso !!!"; // echo "<br>tamanho do ficheiro $origem_size"; // echo " <br>tipo de ficheiro $origem_type"; } else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem2); } ?> </body> </html> but Whit register_globals = off the script B dont work script B: "p.php" <title>Jornal O Leme</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#006699"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="100%" height="70" valign="top"><img src="test.jpg" width="600" height="120"> </td> </tr> <tr> <td height="262" valign="top"><p>&nbsp;</p> <form method="post" action="pi.php" enctype="multipart/form-data"> <table width="75%" border="0" align="center" bgcolor="#FFFFFF"> <tr> <td width="23%"><div align="center"><font face="BankGothic Md BT"> </font></div></td> <td width="77%" bgcolor="#FFFFFF">&nbsp; </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF">&nbsp; </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF">&nbsp; </td> </tr> <tr> <td><div align="left"><strong>Imagem pequena</strong></div></td> <td bgcolor="#FFFFFF"> <input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem"> </td> </tr> <tr> <td><div align="left"><strong>Imagem grande</strong></div></td> <td bgcolor="#FFFFFF"><input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem2"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF">&nbsp; </td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </table> <p align="center"> <input name="submit" type="submit" value="Adicionar"> <input type="hidden" name="page" value="inserir1"> </form></p> </td> </tr> <tr> <td height="81" valign="top"><div align="center"> <p>&nbsp;</p> <p> <?php include ('menu.php'); ?> &nbsp;</p> </div></td> </tr> </table> ---------------------------------------------------------------------------- ------------------------ "pi.php" echo $_REQUEST['page']; returns inserir1 _correct echo $_FILES['origem']; returns ARRAY _error why ? what i have to do to return the temp path of the file to ? im lost set_time_limit(60); $path=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem_name="fdx.jpg"; $dest= $path.$origem_name; if (($origem <> "none") && ($origem <> "")){ if (copy($origem,$dest)){; } else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem); } set_time_limit(60); $path2=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem2_name="porra.jpg"; $dest2= $path2.$origem2_name; //printf("$path"); //printf("<br>"); //printf("$origem_name"); if (($origem2 <> "none") && ($origem2 <> "")){ if (copy($origem2,$dest2)){; //echo "<br>upload do ficheiro $origem_name efectuada com sucesso !!!"; // echo "<br>tamanho do ficheiro $origem_size"; // echo " <br>tipo de ficheiro $origem_type"; } else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem2); } ?> </body> </html>

« previous php.general (#122592) next »