Advertisement

10.15.2008 at 03:23PM PDT, ID: 23818671 | Points: 500
[x]
Attachment Details

Transfered PHP script erroring on new server

Asked by everettmarshall in PHP and Databases, Apache Web Server

Tags: ,

I am moving to a new server and have run into a string of errors that I can't seem to fix.  I'm sure it's something pretty simple but I don't have any more time to work it out myself.

This is the download side of a file uploading script.  When an attempt to download the file is made, these errors appear, followed by the MP3 file data.

Warning: filesize() [function.filesize]: Stat failed for NEWS9Younger-ev.mp3 (errno=2 - No such file or directory) in /nfs/c03/h02/mnt/52362/domains/xxxxxxxxx.com/html/af/download.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /nfs/c03/h02/mnt/52362/domains/xxxxxxxxxx.com/html/af/download.php:24) in /nfs/c03/h02/mnt/52362/domains/filefairy.com/html/af/download.php on line 25

Warning: Cannot modify header information - headers already sent by (output started at /nfs/c03/h02/mnt/52362/domains/xxxxxxxxxxx.com/html/af/download.php:24) in /nfs/c03/h02/mnt/52362/domains/filefairy.com/html/af/download.php on line 26

Warning: filesize() [function.filesize]: Stat failed for files/NEWS9Younger-ev.mp3 (errno=2 - No such file or directory) in /nfs/c03/h02/mnt/52362/domains/xxxxxxxxxx.com/html/af/download.php on line 27

Directory structure is IDENTICAL to the previous server (which still works) and I can confirm that the is in fact in the directory as well.

Can't tell if this is an Apache handling problem or if there is something else happening.

Thanks for the help.
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
<?php
$code = $_GET['id'];
$fileName = "";
 
$handle = opendir('files');
while (false !== ($fileName = readdir($handle))) 
{
	if ($fileName == '.') continue;
	if ($fileName == '..') continue;
	if (strlen($fileName) < 9) continue;
	
	$pos = strpos($fileName, '.');
	if (!$pos) continue;
	
	$fileCode = substr($fileName, 0, $pos);
	if (strcmp($fileCode,$code) == 0) break;
}
 
if ($fileName != '')
{
	$pos = strpos($fileName, '.');
	$realFileName = substr($fileName, $pos + 1, strlen($fileName) - $pos - 1);
	
	$fileSize = filesize($realFileName);
	header("Content-Type: application/octet-stream; name=$realFileName");
	header("Content-Disposition: attachment; filename=$realFileName");
	$fileSize = filesize('files/' . $realFileName);
	
	readfile('files/' . $fileName);
}
else
{
	echo "File not found";
}
?>
 
 
[+][-]10.16.2008 at 01:29AM PDT, ID: 22728885

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.16.2008 at 03:51AM PDT, ID: 22729478

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 - Hierarchy / EE_QW_2_20070628