Page 1 of 1

problem with arguments

Posted: Thu Jun 26, 2003 5:42 am
by cyberyan
All arguments cannot be use on script
if i use $HTTP_GET_VARS or HTTP_POST_VARS it work

but i dont know if it work with file argument

I am on IIS 5 on WINDOWS 2000 PRO

Can somebody help me

Thanks

Posted: Thu Jun 26, 2003 7:16 am
by releasedj
I have no idea what you mean!

When you say "All arguments cannot be use on script" what do you mean by argument?

Do you mean in a function?

Please give some code examples!

Posted: Thu Jun 26, 2003 7:17 am
by volka
if by "arguments" the parameter passed client->server are meant
have a read of Sticky: Before Post Read: Concerning Passing Variables in PHP 4.2+
I might be helpful ;)

Posted: Thu Jun 26, 2003 1:17 pm
by cyberyan
Thank for this
i've not turn on the global_variable on php.ini

Now my pb is file global variable

Code: Select all

<form action="upload_single.php" method="post"
 enctype="multipart/form-data">
 Indiquez le nom du fichier à télécharger :
 <input type="file" name="Fichier">
upload_single.php

Code: Select all

<?php
$Errors="";
if(!empty($Fichier_name))
&#123;$CurBasePath=dirname($PATH_TRANSLATED);
  $NewName=$CurBasePath."/uppics/".$Fichier_name;
  copy($Fichier,$NewName);&#125;
else
&#123;$Errors="Aucun fichier choisi";&#125;
?>
<html>
<head>
<title>Affichage d'une image envoyer en téléchargement
</title>
</head>
<body>
<?php
 
if($Errors !="")
&#123;print("<b>Erreurs:</b> : $Errors<BR>");&#125;
else
&#123;print("Voici l'image téléchargé :<BR><BR>");
print("<img src="uppics/$Fichier_name" border="0">");&#125;
?>
</body>
</html>
in url i've this
upload_single.php?Fichier=F%3A%5Cmotos%5Cmini_7.jpg&submit=submit

and the result is

Erreurs: : Aucun fichier choisi

Thanks for all

Posted: Thu Jun 26, 2003 1:32 pm
by volka
http://www.php.net/features.file-upload has examples of how file uploads are handled with register_globals disabled.
Basically it's about moving the global variables to arrays.
e.g. $Fichier_name becomes $_FILES['Fichier']['name'] and $Fichier becomes $_FILES['Fichier']['tmp_name']

Posted: Fri Jun 27, 2003 5:45 am
by cyberyan
THANK FOR ALL

It works now