on the page, I have:
if (!empty($_FILES['logo']['name'])) { $dossier = 'upload/'; $fichier = basename($_FILES['logo']['name']); $taille_maxi = 100000; $taille = filesize($_FILES['logo']['tmp_name']); $extensions = array('.png', '.jpg', '.jpeg'); $extension = strrchr($_FILES['logo']['name'], '.'); if(!in_array($extension, $extensions)) { $erreur = 'ERROR you must upload the right type'; } if($taille>$taille_maxi) { $erreur = 'too heavy'; } if(!empty($erreur)) {
The problem is that if users want to edit information WITHOUT loading a LOGO, an error occurs: "Error, you must load the desired type"
So, if the user did not put anything in the input field to load it, I do not want to enter these test conditions.
i checked: if (!empty($_FILES['logo']['name']) and if (isset($_FILES['logo']['name'])
but both of them do not work.
Any ideas?
edit: maybe I wasn’t so clear, I don’t want to check if he uploaded the logo, I want to check if he chose the file to upload, because right now, if he doesn’t select the file to upload, php causes an error that says that it should load the desired format.
thank.
file php upload
sf_tristanb Jun 02 '10 at 13:33 2010-06-02 13:33
source share