hi all,
i have face this problem more 3 days.. if anybody help me..
i have upload file through php coding .. i have download that same file from server..
its coming empty file.. i dont know why its coming... its correctly working in local system.. but not working server. Linux server
its very urgent.. pls reply me.
[php]
Its Upload coding:
--------------------------
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES["attachment "]["name"]);
if(move_uploade d_file($_FILES["attachment "]["tmp_name"], $target_path)) {
echo "The file ". basename( $_FILES["attachment "]["name"]).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>[/php]
Its download coding :[php]
<?php
ob_start();
$dirfile=$_REQU EST['file'];
$file=basename( $dirfile);
$dir = "../uploads/";
if ((isset($file)) &&(file_exists( $dirfile))) {
header("Content-type: application/force-download");
header('Content-Disposition: inline; filename="' . $dirfile . '"');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($dir file));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $dirfile . '"');
readfile("$dirf ile");
} else {
echo "No file selected";
}
?>[/php]--------------------------
by
Karthik
i have face this problem more 3 days.. if anybody help me..
i have upload file through php coding .. i have download that same file from server..
its coming empty file.. i dont know why its coming... its correctly working in local system.. but not working server. Linux server
its very urgent.. pls reply me.
[php]
Its Upload coding:
--------------------------
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES["attachment "]["name"]);
if(move_uploade d_file($_FILES["attachment "]["tmp_name"], $target_path)) {
echo "The file ". basename( $_FILES["attachment "]["name"]).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>[/php]
Its download coding :[php]
<?php
ob_start();
$dirfile=$_REQU EST['file'];
$file=basename( $dirfile);
$dir = "../uploads/";
if ((isset($file)) &&(file_exists( $dirfile))) {
header("Content-type: application/force-download");
header('Content-Disposition: inline; filename="' . $dirfile . '"');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($dir file));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $dirfile . '"');
readfile("$dirf ile");
} else {
echo "No file selected";
}
?>[/php]--------------------------
by
Karthik
Comment