Bonjour à tous !
Voila je m'arrache les cheveux depuis pas mal de temps sur un upload de photos !
J'ai simplifié ici le code pour que vous puissiez plus facilement m'aider !
Explications :
J'ai un formulaire tout bête pour envoyer une photo :
<form action="test.php" method="post" name="frmajoutprod" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="204800" />
<table align="center">
<tr>
<td><img src="../img/autres/carre_vert.png" alt="" title="" /></td>
<td>Image :</td> <td><input name="file" type="file" /> <span style="color: red;">(200Ko max) Formats : .jpg, .png ou .gif</span></td>
</tr>
</table>
<hr />
<p align="center"><input type="submit" value="Ajouter" name="bt-ajouter" /></p>
</form>
Et voici le code correspondant :
<?php
if (isset($_POST['bt-ajouter']) )
{
require("../identifiants.php");
$fichier = mysql_real_escape_string($_FILES['file']['name']) ;
if (isset($fichier) and $fichier != null)
{
if( !empty($_FILES['file']['tmp_name']) AND is_uploaded_file($_FILES['file']['tmp_name']) )
{
$chemin = "adminvanina/temp";
if (move_uploaded_file($_FILES['file']['tmp_name'], $chemin))
{
echo 'sa a marcher !';
}
else
{
echo 'sa a PAS marcher !';
}
}
}
}
?>
Précisions :
CE CODE FONCTIONNE EN LOCAL !
Le dossier adminvanina/ et le dossier qui contient ce code.
Le dossier adminvanina/temp/ à les droits 777.
L'hebergeur est 123-domaines.net...
Et pour finir voici les messages d'erreur que j'obtient :
Warning: move_uploaded_file() [
function.move-uploaded-file]: open_basedir restriction in effect. File(/tmp/phpRpJa07) is not within the allowed path(s): (/home/web:/usr/share/php:/usr/share/admin) in
/home/web/acasabellacom/a-casa-bella.com/www/adminvanina/test.php on line
14Warning: move_uploaded_file(/tmp/phpRpJa07) [
function.move-uploaded-file]: failed to open stream: Operation not permitted in
/home/web/acasabellacom/a-casa-bella.com/www/adminvanina/test.php on line
14Warning: move_uploaded_file() [
function.move-uploaded-file]: Unable to move '/tmp/phpRpJa07' to 'adminvanina/temp' in
/home/web/acasabellacom/a-casa-bella.com/www/adminvanina/test.php on line
14
Merci d'avance pour votre aide ! Je galère depuis un bon moment et j'ai essayé des dizaines de solutions sans résultats !!!!