download file from a folder, selecting a date in a calendar

-1

Good morning, I'm somewhat stuck with this exercise, the idea is, based on the calendar that was made (I'll put the code below), that now from a folder stored on the localhost with several pdf files created in different dates , these can be downloaded or viewed depending on the date selected in the calendar, if someone can give me an idea of how to do it, I would appreciate it.

<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.7.2.custom.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript">
jQuery(function($){
    $.datepicker.regional['es'] = {
        closeText: 'Cerrar',
        prevText: '&#x3c;Ant',
        nextText: 'Sig&#x3e;',
        currentText: 'Hoy',
        monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
        'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
        monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
        'Jul','Ago','Sep','Oct','Nov','Dic'],
        dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;bado'],
        dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
        dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],
        weekHeader: 'Sm',
        dateFormat: 'dd/mm/yy',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: ''};
    $.datepicker.setDefaults($.datepicker.regional['es']);
});    

$(document).ready(function() {
   $("#datepicker").datepicker();
 });
</script>
    
asked by Geolo 02.10.2018 в 15:58
source

1 answer

0

You can go through the directory where you have the files and get the creation date. You can create an array with the following structure directly:

$ficheros = [ "2018-10-02" => "/url/al/archivo1.pdf", "2018-10-01" => "/url/al/archivo2.pdf", .... ];

So when the user selects a date you simply have to go comparing dates. When a date coincides, you have the URL of the file directly. You can have more information about the "filectime" instruction . Surely you do well in this case.

    
answered by 02.10.2018 / 16:28
source