<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[accesso utente scarica file pdf  doc]]></title><description><![CDATA[<p dir="auto">ciao e buona serata <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /> sto tentando di far scaricare un file pdf ma non riesco a capire perchè non lo scarica ma quando clicco per scaricare il file si vedono dei caratteri strani <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--disappointed" style="height:1.4em;width:auto;vertical-align:middle" title=":(" alt="😞" />  questo è ciò che ho fatto</p>
<pre><code> &lt;?PHP
			
				
			// Define a function to list files and subfolders
				function list_files($dir) {
				  // Get an array of files and subfolders
				  $files = scandir($dir);
				  // Loop through the array
				  foreach ($files as $file) {
					// Skip the current and parent directories
					if ($file != "." &amp;&amp; $file != "..") {
					  // Get the full path of the file or folder
					  $path = $dir . "/" . $file;
					  // Check if it is a file
					  if (is_file($path)) {
						// Get the file name
						$name = basename($path);
						// Encode the file path
						$url = urlencode($path);
						// Create a download link
						echo "Documento: &lt;a href='download.php?file=$url'&gt;$name&lt;/a&gt;&lt;br&gt;";
					  }
					  // Check if it is a folder
					  if (is_dir($path)) {
						// Print the folder name
						echo "Cartella: &lt;b&gt;$file&lt;/b&gt;";
						// Call the function recursively
						list_files($path);
					  }
					}
				  }
				}

				// Call the function with the main directory
				list_files("documenti/".basename($_SESSION['username']));
				?&gt;
---------------------------------------
download.php
&lt;?php
if(isset($_GET['file'])){
    $var_1 = $_GET['file'];
$dir='documenti/';
}
?&gt;
&lt;?php
if(isset($_GET['file'])){
    $var_1 = $_GET['file'];
$file = $var_1;
if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}
echo "&lt;h1&gt;Content error&lt;/h1&gt;&lt;p&gt;il file non esiste!&lt;/p&gt;";
}
?&gt;




</code></pre>
]]></description><link>https://dev.connect.gt/topic/250311/accesso-utente-scarica-file-pdf-doc</link><generator>RSS for Node</generator><lastBuildDate>Fri, 27 Nov 2026 13:57:13 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/250311.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Apr 2023 16:51:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to accesso utente scarica file pdf  doc on Thu, 20 Apr 2023 12:27:07 GMT]]></title><description><![CDATA[<p dir="auto">risolto non so il perchè ma ha funzionato <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--smile" style="height:1.4em;width:auto;vertical-align:middle" title=":D" alt="😄" /></p>
]]></description><link>https://dev.connect.gt/post/1309470</link><guid isPermaLink="true">https://dev.connect.gt/post/1309470</guid><dc:creator><![CDATA[imperor]]></dc:creator><pubDate>Thu, 20 Apr 2023 12:27:07 GMT</pubDate></item></channel></rss>