<img src="<?php echo \General::getURIforDownload('mycontroller', 'edoc=sunflower.jpeg');?>">
$(function () {
// Refresh the list of stored files
var refreshFileList = function() {
var uriForDownload = '<?php echo \General::getURIforDownload('jugadoresctrl');?>';
znetdk.request({
control:'jugadoresctrl',
action:'files',
callback: function(response) {
//var listElement = $('#list_of_files_formf8 ul'),
files = response;
// listElement.empty();
// for (i = 0; i < files.length; i++) {
$('#mis_jugadores ul').append('<img src='
+ uriForDownload
// + '" title="' + files[i].description
+ '>' );
// + files[i].filename + '</a></li>' + '&file_id='}
//+ files.Use_FOTO
}
});
}
// The file list is loaded when the view is displayed for the 1st time
refreshFileList();
// No thumbnail displayed when a file is selected
$("#mis_jugadores input[name=foto]").zdkinputfile({
showThumbnail: true /* thumbnail displayed */
});
$("#mis_jugadores input[name=foto]").on('change', function () {
var selectedFile = $(this).zdkinputfile('getFileName');
$("#mis_jugadores input[name=Use_FOTO]").val(selectedFile);
});
});
static protected function action_files() {
$request = new \Request();
$filesDao = new \app\model\jugadorDAO();
$foto=$request->id_usuario;
$filesDao->setFotoUser($foto);
// $filePath = CFG_DOCUMENTS_DIR . DIRECTORY_SEPARATOR;
//$directorio_escaneado = scandir($filePath);
$files = array();
// foreach ($directorio_escaneado as $item) {
// if ($item != '.' and $item != '..' and $item != 'F11'and $item != 'F8') {
// $files[] = $item;
while ($row = $filesDao->getResult()) {
$files[] = $row;
}
// }
$response = new \Response();
// The list of stored files is returned
$response->setResponse($files);
return $response;
}
static public function action_download() {
$request = new \Request();
$rowID = $request->id_usuario;
$response = new \Response();
// The file is serached from its database row ID
$filesDao = new \app\model\jugadorDAO();
$fileInfos = $filesDao->getById($rowID);
if ($fileInfos === FALSE) {
$response->setFailedMessage("Descargar", "El archivo '{$request->id_usuario}' no existe en la base de datos!");
return $response;
}
// The 'location' columns contains the filename of the file stored on
// the web server
$storedFile = CFG_FOTOS_DIR . DIRECTORY_SEPARATOR . $fileInfos['Use_FOTO'];
if (file_exists($storedFile)) {
//$response->setFileToDownload($storedFile, TRUE);
return $storedFile;
} else {
$response->setFailedMessage("Descargar", "El archivo '{$fileInfos['Use_FOTO']}' no ha sido encontrado!");
}
return $response;
}
$response->setFileToDownload($storedFile, TRUE);
<img src="<?php echo \General::getURIforDownload('jugadoresctrl', 'id_usuario='<?php echo (int)$_POST['id_usuario']?>);?>">