Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 150
  • Last Modified:

cant open uploaded file on cakephp

Hi, I am trying to open a file that has been uploaded to attachments folder on a cakephp project. I have a list of files I select after uploading . This works fine on my PC but on the remote server it is throwing a 503 error which I have no idea in what to do . The error logs show nothing.

 public function download2($attachment_id = null){
		
		$file = $this->Tutor->Attachment->find('first', array('conditions' => array('Attachment.id' => $attachment_id), 'recursive' => -1));
		//pr($file); die;
		if(!empty($file)){
    		$this->response->file($file['Attachment']['url'], array('name' => $file['Attachment']['org_filename']));
			//Return reponse object to prevent controller from trying to render a view
			return $this->response;			
		}    	
		else{
			$this->Session->setFlash(__('Error encountered while downloading the file. Please, try again.'),'flash_alert');
		}
		
   }

Open in new window

0
jagguy
Asked:
jagguy
  • 2
  • 2
1 Solution
 
Ray PaseurCommented:
The 5XX errors are server failures, and it may have nothing to do with your uploaded files.
503 Service Unavailable
    The server is currently unavailable (because it is overloaded or down for maintenance).
Refs:
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html (see 10.5.4)
0
 
jagguyAuthor Commented:
no this is a cakephp problem masking as a server error. I know this from past problems people have but fixing it isnt clear
0
 
RobOwner (Aidellio)Commented:
What I would do is isolate this as being either PHP or within the Cake framework.

The PAQ'd question has a test script that I suggest you try on your server to do a simple file upload: http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28454668.html

IF the file upload works fine then you know it's a configuration setting in cake that's causing the issue.  However if it doesn't work then it could be a PHP configuration difference (such as max file size) between your PC and your server.

Please report back your findings.
0
 
jagguyAuthor Commented:
I tried a new server and it works
0
 
RobOwner (Aidellio)Commented:
So that sounds like it was a php issue.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now