<?php
	$upload_max_filesize = ini_get("upload_max_filesize");
	$post_max_size = ini_get("post_max_size");
	$upload_max_filesize = str_replace( "k", "000", $upload_max_filesize );
	$upload_max_filesize = str_replace( "M", "000000", $upload_max_filesize );
	$post_max_size = str_replace( "k", "000", $post_max_size );
	$post_max_size = str_replace( "M", "000000", $post_max_size );
	
	//Dimensione minima: 12MB
	$alerts = '';
	
	if( $upload_max_filesize < 16000000 ){
		$alerts .= "Devi modificare il tuo <b>php.ini</b> impostando <b>upload_max_filesize</b> almeno a 16MB altrimenti non riuscirai a caricare l&rsquo;aggiornamento.<br>";
	}
	
	if( $post_max_size < 16000000 ){
		$alerts .= "Devi modificare il tuo <b>php.ini</b> impostando <b>post_max_size</b> almeno a 16MB altrimenti non riuscirai a caricare l&rsquo;aggiornamento.<br>";
	}
	
	if( strlen($alerts) > 0 ){
		echo "<div class='alert alert-warning'>".$alerts."</div>\n";
	}
	
	
	
    echo "<br><br>\n";
    
    echo "<div class='row'>\n";
    echo "	<div class='col-md-12'>\n";
    echo "		<h3>Seleziona un file csv da caricare</h3>\n";

    echo "<form action=\"".$rootdir."/controller.php?id_module=".$id_module."\" method=\"post\" enctype=\"multipart/form-data\" class='form-inline' id='new-module'>\n";
    echo "	<input type='hidden' name='op' value='upload'>\n";
	
	
    echo "	<label><input type=\"file\" name=\"blob\"></label><button type='button'   class='btn btn-primary' onclick=\"if( confirm('Avviare la procedura?') ){ $('#new-module').submit(); }\"><i class='fa fa-upload'></i> Carica...</button>\n";
    echo "</form><br>\n\n";
	

	echo "	</div>\n";
	echo "</div>\n";
    
    
    
?>
   