You might receive 2 files throught upload,
then the first file name should be $_FILES['origem'] ;
and the second file name $_FILES['origem2'] ;
To use the different variables you can use, peer John Holmes's answer, there
aren't no full answer like this anywhere?
to ask if file uploaded is ok
uploaded_file() is better than you are doing
and use move_uploaded_file() instead copy() and unset() ;
like this :
if (is_uploaded_file($_FILES['origem']) )
move_uploaded_file($_FILES['origem'], $dest) ;
/*
$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 ";
}
unlink ($origem);
}
- Original Message -
From: "'marcelo'" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 04, 2002 12:46 PM
Subject: RE: [PHP] uploading help please again
Ok I'm back
This script is to upload 2 image files
Whit register_globals = on it Works fine
script A
"p.php"
Jornal O Leme
Imagem pequena
Imagem grande
"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 ";
}
unlink ($origem);
}
set_time_limit(60);
$path2=(dirname($PATH_TRANSLATED))."/primeirapagina/";
$origem2_name="porra.jpg";
$dest2= $path2.$origem2_name;
file://printf("$path");
file://printf("");
file://printf("$origem_name");
if (($origem2 <> "none") && ($origem2 <> "")){
if (copy($origem2,$dest2)){;
file://echo "upload do ficheiro $origem_name efectuada com sucesso !!!";
// echo "tamanho do ficheiro $origem_size";
// echo " tipo de ficheiro $origem_type";
} else {
echo "directoria sem direitos de escrita ";
}
unlink ($origem2);
}
?>
but Whit register_globals = off the script B dont work
script B:
"p.php"
Jornal O Leme
Imagem pequena
Imagem grande
"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 ";
}
unlink ($origem);
}
set_time_limit(60);
$path2=(dirname($PATH_TRANSLATED))."/primeirapagina/";
$origem2_name="porra.jpg";
$dest2= $path2.$origem2_name;
file://printf("$path");
file://printf("");
file://printf("$origem_name");
if (($origem2 <> "none") && ($origem2 <> "")){
if (copy($origem2,$dest2)){;
file://echo "upload do ficheiro $origem_name efectuada com sucesso !!!";
// echo "tamanho do ficheiro $origem_size";
// echo " tipo de ficheiro $origem_type";
} else {
echo "directoria sem direitos de escrita ";
}
unlink ($origem2);
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php