ou se trouve le fichier uploader dans le dossier tmp de php ?
Bonjour,
j'essaye de trouver le chemin d'une image temporaire,
mais je sais pas ou il se trouve, je vérifie si php arrive bien à récupérer cette image et à le déposer dans un dossier de symfony
Code:
1 2
|
echo "<img>alert('".$_FILES['file']['tmp_name']."')</script>"; |
il m'affiche tmp/php1A ...
sous ubuntu je ne le trouve pas
voici ma vu qui appelle un script de récupération d'une image uploader
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="{{ asset('lib/redactor/css/style.css') }}" type="text/css" />
<link rel="stylesheet" href="{{ asset('lib/redactor/redactor/css/redactor.css') }}" type="text/css" />
<script src="{{asset('lib/redactor/redactor/redactor.js')}}"></script>
<script type="text/javascript">
$(document).ready(
function()
{
$('#office_documentbundle_htmltexttype_contenuhtml').redactor({
imageUpload: "http://localhost/Symfony/www/lib/redactor/demo/scripts/image_upload.php",
fileUpload: 'http://localhost/Symfony/www/lib/redactor/demo/scripts/file_upload.php',
imageGetJson: 'http://localhost/Symfony/www/lib/redactor/demo/scripts/data.json'
});
}
);
</script> |
voici image_upload.php
Code:
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 48 49
|
<?php
echo "<img>alert('".$_FILES['file']['tmp_name']."')</script>";
//script ok
// copying
// This is a simplified example, which doesn't cover security of uploaded images.
// This example just demonstrate the logic behind the process.
// setting file's mysterious name
$file = $dir.$filename;
// files storage folder
$dir = "../../img/";
$_FILES['file']['type'] = strtolower($_FILES['file']['type']);
$_FILES['file'] ="http://localhost/Symfony/www/upload/" ; //on détermine un dossier ou on peut déposer avec les droit
if ($_FILES['file']['type'] == 'image/png'
|| $_FILES['file']['type'] == 'image/jpg'
|| $_FILES['file']['type'] == 'image/gif'
|| $_FILES['file']['type'] == 'image/jpeg'
|| $_FILES['file']['type'] == 'image/pjpeg')
{
// copying
copy($_FILES['file']['tmp_name'], $file);
// displaying file
$array = array(
'filelink' => '/lib/redactor/img/'.$filename
);
echo stripslashes(json_encode($array));
}
?> |
se script ne dépose pas l'image uploader, donc j'essaye de comprendre pourquoi cela ne fonctionne pas,
si vous avez une idée, merci d'avance pour la réponse.