i am reading file and getting content , on localhost it is working and displaying result.

but after uploading on server , not displaying or echo relevant content of file?

any help appre

thnx

$tcnt = 0;
$file = fopen("/home/uploads/date/".$list."_".$Type.".txt", "r") or exit("Unable to open file!");
				$file_rl = $file;
				
			while(!feof($file)) {
				$line=fgets($file);
                                
					if($line!='') {
                                            
						$lineq=explode("|",$line);
                                                
                                           
		
						if($tcnt==0){
								$head=$lineq;
								
								foreach($lineq as $fields){
							         //echo $fields.",  ";
								echo "<pre>";
								print_r($fields);
								}
						}

					
						else{
                                                           // insertion code goes here


						  }

Recommended Answers

All 4 Replies

/home/uploads/date/ exist on server?

/home/uploads/date/ exist on server?

fopen("/home/users/web/b1765/moo.somthing/ethom/uploads/data/".$listPage."_".$propType.".txt", "r") or exit("Unable to open file!");

acctu i tested this there is no problem here and getting file resource id.

Maybe, file permission. Set the permission for that file '755'.
Hope this help.

$tcnt = 0;
$file = fopen("/home/uploads/date/".$list."_".$Type.".txt", "r") or exit("Unable to open file!");
$file_rl = $file;
while(!feof($file)) {
$lineq = fgetcsv($file,, "|"); 
if($tcnt==0){ $head=$lineq;
foreach($lineq as $fields){ //echo $fields.",  ";
echo "<pre>";
print_r($fields);
}
}
else{ // insertion code goes here
}

ignore this, was experimentig with the code and clicked post

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.