Bonjour,

j'ai un petit souci quand j'essai d'uploader un fichier(mp3) en local sur wamp :
Configuration Serveur
Version de Apache:
2.2.8
Version de PHP:
5.2.6

le souci c'est par exemple j'ai fixé dans mon php.ini les valeurs suivant
upload_max_filesize = 7M
post_max_size = 7M
memory_limit = 1024M

et quand j'essai d'uploader un fichier de 10mo il y a une condition qui n'est jamais vérifié dans mon méthode et aussi le script ne fait rien
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
if($files['fichier']['size'] < $this->maxSize())
voici mon code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
 public function doUpload($files,$repertoire) {
 
			if($files['fichier']['error']!=UPLOAD_ERR_NO_FILE)
			{
				$tmp_name=$files['fichier']['tmp_name'];
				if(is_uploaded_file($tmp_name))
				{
					$type_file = $files['fichier']['type'];
					$allowed_types = array("audio/mpeg","application/octet-stream");	
					if(in_array($type_file,$allowed_types))
					{
							if($files['fichier']['size'] < $this->maxSize())
							{
								$this->namefile = $files['fichier']['name'];
								if(file_exists($repertoire) and !file_exists($repertoire.$this->namefile)) 
								{
									if(move_uploaded_file($tmp_name, $repertoire.$this->namefile))
									{
											echo " <strong>".$this->getName(). "</strong> is uploaded";
									}else{
											throw new Exception ("impossible to copy file");
											return false;
									}
								}else{
									throw new Exception ("<strong>".$this->getName()."</strong>  already exist");
									return false;
								}	
 
							}else{
									throw new Exception ("file size too big");
									return false;
							}			
					}else{
							throw new Exception ("type not authorized");
							return false;
					}
				}else{
					throw new Exception ("no file to upload");
					return false;
				}
			}else{
				throw new Exception ("file is empty : browse a file");
				return false;
			}
 
		}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
if(isset($_POST['playlist']) and $_POST['playlist']!=null) {
		$destination = 'audiofile/'.$_POST['playlist'].'/';
		try 
		{
					$objetPlaylist->doUpload($_FILES,$destination);
 
		} catch (Exception $e) {			
					echo $e->getMessage();
		}
	}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
<form method="post" action="<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" >
									<table width="200" style="border:1px solid #dadada;margin:5px;">
										<tr>
											 <td colspan = "3"> <strong> UPLOAD NEW SONG PANEL</strong></td>
										</tr>
										<tr>
											<td><label>fichier:</label></td>
											<td><input type="hidden" name="playlist" value="<?php if(isset($_SESSION['playlist'])) echo $_SESSION['playlist']; ?>" ></input></td>
											<td><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $objetPlaylist->maxSize(); ?>" /></td>
											<td><input type="file" name="fichier" ></input></td>
 
 
										</tr>
										<tr>
											<td></td>
											<td>&nbsp;</td>
											<td><input type="submit" value="Envoyer" /></td>
										</tr>
									</table>
								</form>
si vous avez une idée merci pour votre aide