Uploadify pas de fichiers (windows)
Bonjour,
J'utilise un plugin jquery pour justement envoyer des fichiers vers un serveur.
Actuellement je travaille en local pour tester le script.
Mon souci se situe lors du chargement du fichier. J'aimerais pouvoir trouver une solution. J'ai essayé de trouver des réponses dans le forum et ailleurs (sur le site d'uploadify) mais j'ai rien trouvé. Voici mon script pour avoir un éclaircissement:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <script type="text/javascript">
$(document).ready(function() {
$('#uploadify').uploadify({
'uploader' : 'uploadify/uploadify.swf',
'script' : 'uploadify/uploadify.php',
'cancelImg' : 'uploadify/cancel.png',
'folder' : 'uploads/photos',
'buttonText': 'Charger photo',
'fileDesc' :'Fichier *.JPG ou *.PNG.',
'fileExt' :'*.jpg;*.jpeg;*.png;*.JPG;*.JPEG;*.PNG',
'multi' : false,
'auto' : false
});
});
</script><p><input type="file" name="uploadify" id="uploadify" /></p><p> </p>
<p><a class="button" href="javascript:$(\'#uploadify\').uploadifyUpload()">Valider</a></p>
<p> </p> |
uploadify.php
Code:
1 2 3 4 5 6 7 8 9 10
| if (!empty($_FILES))
{
$tempFile = $_FILES['Filedata']['tmp_name'];
// $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetPath = $_SERVER['DOCUMENT_ROOT'].'uploads/photos/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
move_uploaded_file($tempFile,$targetFile);
echo "1";
} |