[Forum] Upload des fichiers avec ftp
bonsoir tout le monde,
Je rencontre un soucis avec l'uplaod des fichiers via FTP en php, voici le message erreur après la validation de mon forum
Code:
1 2
|
Warning: ftp_put() [function.ftp-put]: Filename cannot be empty in /home/www/modifOffre.php on line 604 |
voici maintenant le code php de mon script :
Code:
1 2 3 4 5
| <form action='' method='post' enctype='multipart/form-data'>
<input type='hidden' name='MAX_FILE_SIZE' value=100000>
<input name='logo_contact' type='file' value='' size=32/>
<input name='ajoutOffre_submit' type='submit' value='Valider'/>
</form> |
après la validation :
Code:
1 2 3 4 5 6 7 8 9 10 11
| $source_file = $_FILES["logo_contact"]["name"];
if($source_file != "")
{
$repDestination = "/logos/offres/";
$nomFichierSortie = "$idOffre";
$file = $_FILES['logo_contact'];
$nomFile = $_FILES["logo_contact"]["name"];
$fileExt = pathinfo("$nomFile", PATHINFO_EXTENSION);
$imageName = "$nomFichierSortie.$fileExt";
$upload = ftp_put($conn_id, $repDestination . "$nomFichierSortie.$fileExt", $file['tmp_name'], FTP_BINARY);
} |
Merci d'avance pour votre aide !