Buon giorno, sono gg che cerco di far funzionare sto benedetto script per il multiupload Uploadify, ma non c'è verso.
Ho provato a caricare un file da un semplicissimo form e non ho problemi, ma se utilizzo questo script si.
codice:
//nella pagina demo.php
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="jquery.uploadify.v2.0.0.min.js"></script>
<body>
<div class="demo">
Multiple File Upload</p>
<input id="Filedata" name="Filedata" type="file"/> Upload Files | Clear Queue</div>
<script type="text/javascript">
$(document).ready(function() {
$("#Filedata").uploadify({
'uploader' : 'uploadify.swf',
'script' : 'uploadify.php',
'cancelImg' : 'cancel.png',
'folder' : 'example/uploads',
'multi' : true
});
});
</script>
</body>
nella pagina uploadify.php
Codice PHP:
echo "Passo da qui";
var_dump($_FILES['Filedata']['tmp_name']);exit;
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
//$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetPath = "example/uploads" . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
$fileTypes = str_replace('*.','',$_REQUEST['fileext']);
$fileTypes = str_replace(';','|',$fileTypes);
$typesArray = split('\|',$fileTypes);
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'],$typesArray)) {
// Uncomment the following line if you want to make the directory if it doesn't exist
mkdir(str_replace('//','/',$targetPath), 0755, true);
move_uploaded_file($tempFile,$targetFile);
echo "1";
} else {
echo 'Invalid file type.';
}
}
un'ultima cosa, come posso farmi restituire a video un eventuale errore o testo, dalla pagina uploadify.php?
spero possiate aiutarmi, è importante
grazie mille.