Note that there are some explanatory texts on larger screens.

plurals
  1. POsecure download file not open correctly in php
    primarykey
    data
    text
    <p>Hi Friends i am using secure php file download script, file download successfully, butt issu is that file not open, and also when a popup open that u open a file or Save it, Every file length is "20 kb"</p> <p>I show u my Code</p> <p>index.php</p> <pre><code>&lt;table class="widefat posts" cellspacing="0" style="margin-top:20px;"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th scope="col" width="30%"&gt;&lt;a href="javascript:;"&gt;Responder&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" width="30%"&gt;&lt;a href="javascript:;"&gt;From&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" width="20%"&gt;&lt;a href="javascript:;"&gt;Subject&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" width="35%"&gt;&lt;a href="javascript:;"&gt;Attachment&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" width="10%"&gt;&lt;a href="javascript:;"&gt;Edit&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" width="10%"&gt;&lt;a href="javascript:;"&gt;Delete&lt;/a&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tfoot&gt; &lt;tr&gt; &lt;th scope="col" width="30%"&gt;&lt;a href="javascript:;"&gt;Responder&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" width="30%"&gt;&lt;a href="javascript:;"&gt;From&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" width="20%"&gt;&lt;a href="javascript:;"&gt;Subject&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" width="35%"&gt;&lt;a href="javascript:;"&gt;Attachment&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" width="10%"&gt;&lt;a href="javascript:;"&gt;Edit&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" width="10%"&gt;&lt;a href="javascript:;"&gt;Delete&lt;/a&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/tfoot&gt; &lt;tbody&gt; &lt;?php $sql = "SELECT * FROM $table"; $results = $wpdb -&gt; get_results($sql); ?&gt; &lt;?php if( !empty( $results ) ) : ?&gt; &lt;?php foreach( $results as $result ): ?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo $result -&gt; resp_name; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $result -&gt; from_email; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $result -&gt; subject; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="&lt;?php echo get_bloginfo('siteurl'); ?&gt;/download.php?filename=&lt;?php echo $result -&gt; att_name; ?&gt;"&gt;&lt;?php echo $result -&gt; att_name; ?&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="admin.php?page=files&amp;action=update&amp;id=&lt;?php echo $result -&gt; id; ?&gt;"&gt;Update&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="admin.php?page=files&amp;action=delete&amp;id=&lt;?php echo $result -&gt; id; ?&gt;"&gt;Delete&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php endforeach; ?&gt; &lt;?php else: ?&gt; &lt;tr&gt; &lt;td colspan="5"&gt;No Responders&lt;/td&gt; &lt;/tr&gt; &lt;?php endif; ?&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>And the Download.php File</p> <pre><code>&lt;?php require('wp-config.php'); $file = $_GET['filename']; $sql = "Select * From wp_paypal_responders Where att_secure = '$file'"; $qry = mysql_query($sql); $obj = mysql_fetch_object($qry); $fileName = $obj-&gt;att_secure; $download_dir = $_SERVER['HTTP_HOST'].'/uploads/'; $fullPath = $download_dir.$fileName; // Required for some browsers if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); // Determine Content Type switch ($ext) { case "pdf": $ctype="application/pdf"; break; case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "doc": $ctype="application/msword"; break; case "xls": $ctype="application/vnd.ms-excel"; break; case "ppt": $ctype="application/vnd.ms-powerpoint"; break; case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "jpeg": case "jpg": $ctype="image/jpg"; break; default: $ctype="application/force-download"; } header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: $ctype"); header("Content-Length: " .filesize($fullPath) ); header('Content-Disposition: attachment; filename="'.basename($fullPath).'"'); header("Content-Transfer-Encoding: binary"); readfile( $fullPath ); fopen($fullPath); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload