<script language='JavaScript' type='text/javascript'>
$(document).ready(function() {
$('#file_upload').uploadify({
'uploader' : 'photo/uploadify.swf',
'script' : 'photo/uploadify.php',
'cancelImg' : 'photo/cancel.png',
'folder' : 'photo/uploads',
'fileExt' : '*.jpg;*.gif;*.png',
'fileDesc' : 'Image Files',
'removeCompleted' : false,
'multi' : true,
'wmode' : 'transparent',
'hideButton' : true,
[B]'onOpen' : function(event,ID,fileObj) {
$('#uploader_message').text('The upload is beginning for ' + fileObj.name);
}[/B]
});
});
</script>
Данный кусок выделенный жирным шрифтом выводит имя файла который уже загружен. Ниже приведу code php обработчика:
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
[B]$dateName[/B] = date("mdyHis").'_'.mt_rand ().'.jpg';
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath).$dateName;
$targetPath1 = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/tmpl/';
$targetFile1 = str_replace('//','/',$targetPath1).$dateName;
$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);
mkdir(str_replace('//','/',$targetPath1), 0755, true);
crop($tempFile, $targetFile1, $crop = 'square',$percent = false);
resize($targetFile1, $targetFile1, 50, 50, $percent = false);
move_uploaded_file($tempFile,$targetFile);
echo $targetFile;
echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
} else {
echo 'Invalid file type.';
}
}
Мне необходимо вывести переменную выделенную жирным на клиента и создать массив из имен всех файлов после чего масив поместить в скрытый импут формы. напишите как это сделать! Мне необходимо решение ото понять ничего не могу