  | 
              
	              
	                
  
    
	 
        จะทำ auto download file ติดปัญหานิดเดียว ช่วยหน่อยเถอะ     | 
   
  
    |   | 
   
 
 
 
	
		
			  | 
	   | 
	    | 
		
			  | 
	 
	
		
			  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                โปรแกรมนี้ มันทำการ download ไฟล์ swap.txt แบบ auto 
โปรแกรมนี้ชื่อ autodown.php 
code ข้างใน 
 
 
Code (PHP) 
<?php
$export_file = "swap.txt";
ob_end_clean();
ini_set('zlib.output_compression','Off');
header('Pragma: public');
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header ("Pragma: no-cache");
header("Expires: 0");
header('Content-Transfer-Encoding: none');
header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera
header("Content-type: application/x-msexcel"); // This should work for the rest
header('Content-Disposition: attachment; filename="'.basename($export_file).'"');
?>
 
 
มันทำงานได้ดีมาก แ่ต่ผมต้องการให้มันทำงานอีกครั้ง ผมก็เพิ่มตรงนี้เข้าไป แต่มันไม่ยอมทำงานที่ ทุกๆ 8 วิตามที่ตั้งไว้ ผมต้องการให้มัน download ไฟล์นี้จาก server ทุกๆ 8 วิ ปรกติถ้าเรากดปุ่ม reload ที่ browser มันจะให้ download ให้ แต่พอเขียนโปรแกรมดังนี้ มันไม่ยอม 
 
โปรแกรมนี้ชื่อ auto.php 
code ข้างใน 
 
Code (PHP) 
<html><head><title>autosave setoutput.txt</title></head>
<META HTTP-EQUIV="Refresh" CONTENT="8;URL=auto.php">  สั่งให้ reload ทุก 8 วิ
<?php
$export_file = "swap.txt";
ob_end_clean();
ini_set('zlib.output_compression','Off');
header('Pragma: public');
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header ("Pragma: no-cache");
header("Expires: 0");
header('Content-Transfer-Encoding: none');
header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera
header("Content-type: application/x-msexcel"); // This should work for the rest
header('Content-Disposition: attachment; filename="'.basename($export_file).'"');
?>
</body>
</html>
 
 
  Tag : PHP, CakePHP               
                        | 
           
          
            | 
			
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2013-06-22 15:14:56 | 
                      By :
                          tong_tong_tong | 
                      View :
                          2433 | 
                      Reply :
                          5 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  | 
	 
	
		
			  | 
		  | 
		
			  | 
		
			  | 
	 
 
              
  
          
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ผมลอง แบบนี้ก็ไม่ได้ 
 
Code (PHP) 
<html><head><title>autosave setoutput.txt</title></head>
<META HTTP-EQUIV="Refresh" CONTENT="8;URL=auto.php">  สั่งให้ reload ทุก 8 วิ
</body>
</html>
  
 
 
 
ไฟล์ auto.php 
 
Code (PHP) 
<?php
 
$export_file = "swap.txt";
ob_end_clean();
ini_set('zlib.output_compression','Off');
 
header('Pragma: public');
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header ("Pragma: no-cache");
header("Expires: 0");
header('Content-Transfer-Encoding: none');
header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera
header("Content-type: application/x-msexcel"); // This should work for the rest
header('Content-Disposition: attachment; filename="'.basename($export_file).'"');
 
?>
 
 
 
ทำไงดีคับ งง                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2013-06-23 13:26:31 | 
                        By :
                            tong_tong_tong | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 สรุปว่า ใช้ เดลไฟ มาช่วย ทำได้แล้วครับ autodownload กี่ไฟล์ก็ได้ upload กี่ไฟล์ก็ได้ 
ตั้งได้ว่าจะทำงานทุกกี่วิ ใช้เดลไฟ ทีเดียวจบ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2013-06-23 16:07:03 | 
                        By :
                            tong_tong_tong | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ตั้งได้ว่าจะทำงานทุกกี่วิ ใช้เดลไฟ ทีเดียวจบ ขอด้วยครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2013-06-23 19:32:06 | 
                        By :
                            ขอด้วยครับ | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                                          
               
               | 
             
            
              
			  			  
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2013-06-23 20:57:19 | 
                        By :
                            mr.win | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |