why my downloaded file is alwayes damaged or corrupted?

why my downloaded file is alwayes damaged or corrupted?

This is my code
<html>
<form action='../biopydb/new.php' method='post'>
<?php

$Pathway_Name = $_COOKIE['pathwayname'];
$dir1    ="../biopydb/Pathway_Images/"."$Pathway_Name/";

$dirPath = dir($dir1);
$imgArray = array();
while (($file = $dirPath->read()) !== false)
{
  if ((substr($file, -3)=="gif") || (substr($file, -3)=="jpg") || (substr($file, -3)=="png"))
  {
     $imgArray[ ] = trim($file);
  }
}

sort($imgArray);
$c = count($imgArray);
for($i=0; $i<$c; $i++)
{
$value = "$dir1"."$imgArray[$i]";
echo "<input type='radio' name='group1'  value='$value' /> $imgArray[$i] <br/>";

}
?>
<br/><br/>
<center>
<input type='submit' value='Download'/></center>
</form>
</html>

new.php
<?php
$Pathway_Name = $_COOKIE['pathwayname'];
$dir1    ="../biopydb/Pathway_Images/"."$Pathway_Name/";

$filename = $_POST["group1"];

echo"$filename";

header("Content-Disposition: attachment; filename=\"" . basename($filename) . "\"");
header("Content-Type: application/force-download");
header("Content-Length: " . filesize($filename));
header("Connection: close");
?>
View Answers









Related Tutorials/Questions & Answers:
why my downloaded file is alwayes damaged or corrupted?
Why are my variables not dividing properly?
Advertisements
why my keyevent not function ? - java swing -
why my keyevent not function ? - java swing -
why java file save as its class name
In netbean jdk, it does not import the file,"java.nio.file.Paths". why?.
file uploads to my web site
attach file in my web page
regarding css file in my eclipse
Why is my program running an infinite loop? Parallel Arrays Program
How to make a damaged road, make a damaged road, damaged road
can't read my xml file in java
can't read my xml file in java
can't read my xml file in java
can't read my xml file in java
can't read my xml file in java
can't read my xml file in java
Probblems with printing if my innput of text file is correct..
how to create a jar file for my packages classs - Struts
problem in creating create .ipa file in my iPhone app
Problem to print from my properties file - Java Server Faces Questions
how to send my system.out.println in a class file to a jsp in Struts2
Problem to print from my properties file - Java Server Faces Questions
I have netbeans jdk 7.0, till it cann't import the file,"java.nio.file.Paths". Why?
Retriving zip file stored in database into my own filesystem
jsf application war file not running in my jboss 6.0 on linux 5.5
RetController.java (do get) (my file for reference for a test.. IS LOGIC good Enough ?
why it is very slow when I am using the backend as microsoft access file for running the java webapplication - SQL
Want to access my Ms-access Db file which is placed inside the same Jar file
this is my file upload page, here i am not getting tags input field value to my servlet,please suggest a solution?
Why request.getParameter(
Why spring?
How can I open my Java desktop app by clicking on its file?
Why NSMutableDictionary
ModuleNotFoundError: No module named 'why'
why this can't
Why this is not working...?
why jre in jdk
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..
sir, how to read empty cell in excel file using poi and how to add this empty cell to arraay list and the following is my code
Why it called Struts?
why the php is open source?
why using static keyword
Why is super.super.method(); not allowed in Java?
why not float main?
why not float main?
Why Ajax for web?
Why "<![CDATA[ ]]>" CDATA tag.
Java is an opensource program or not? why???
ModuleNotFoundError: No module named 'why_nester'

Ads