Welcome Guest, Not a member yet? Register   Sign In
File Upload - Server is not responding
#1

[eluser]Joey Marchy[/eluser]
When using the file upload class, some image files upload fine while others timeout. After a timeout, I can go back and upload other files fine. It just seems to be particular files. Things I have tried to fix this issue:

* Rename files before uploading

Any thoughts or ideas would be greatly appreciated.

Here is the message I receive:

Quote:Safari could not open the page “http://apol0829.dev/app/course/do_upload” because the server is not responding.

I've attached an example of one file that times out continually (pic003.jpg). Here is a copy of my log file from the time uploading begins to the timeout:

DEBUG - 2008-11-08 17:28:45 --> Config Class Initialized
DEBUG - 2008-11-08 17:28:45 --> Hooks Class Initialized
DEBUG - 2008-11-08 17:28:45 --> URI Class Initialized
DEBUG - 2008-11-08 17:28:45 --> Router Class Initialized
DEBUG - 2008-11-08 17:28:45 --> Output Class Initialized
ERROR - 2008-11-08 17:28:45 --&gt; Severity: Warning --&gt; fopen(/Users/joeymarchy/Sites/apol0829/app/apol0829/cache/26657d5ff9020d2abefe558796b99584) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied /Users/joeymarchy/Sites/apol0829/app/apol0829/codeigniter/Common.php 49
DEBUG - 2008-11-08 17:28:45 --&gt; Input Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; XSS Filtering completed
DEBUG - 2008-11-08 17:28:45 --&gt; XSS Filtering completed
DEBUG - 2008-11-08 17:28:45 --&gt; XSS Filtering completed
DEBUG - 2008-11-08 17:28:45 --&gt; XSS Filtering completed
DEBUG - 2008-11-08 17:28:45 --&gt; XSS Filtering completed
DEBUG - 2008-11-08 17:28:45 --&gt; XSS Filtering completed
DEBUG - 2008-11-08 17:28:45 --&gt; Global POST and COOKIE data sanitized
DEBUG - 2008-11-08 17:28:45 --&gt; Language Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Loader Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Config file loaded: config/freakauth_light.php
DEBUG - 2008-11-08 17:28:45 --&gt; Helpers loaded: url, form, array, freakauth_light, html
DEBUG - 2008-11-08 17:28:45 --&gt; Database Driver Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; FreakAuth Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Session Class Initialized (db)
DEBUG - 2008-11-08 17:28:45 --&gt; sending session cookie
DEBUG - 2008-11-08 17:28:45 --&gt; Helpers loaded: form
DEBUG - 2008-11-08 17:28:45 --&gt; Helpers loaded: url
DEBUG - 2008-11-08 17:28:45 --&gt; Helpers loaded: freakauth_light
DEBUG - 2008-11-08 17:28:45 --&gt; Model Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Model Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Model Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Model Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Controller Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Model Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Validation Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Model Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Model Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Upload Class Initialized
DEBUG - 2008-11-08 17:28:45 --&gt; Language file loaded: language/english/upload_lang.php
ERROR - 2008-11-08 17:28:45 --&gt; The file was only partially uploaded.
DEBUG - 2008-11-08 17:28:45 --&gt; File loaded: /Users/joeymarchy/Sites/apol0829/app/apol0829/application/views/template/menu_account.php
DEBUG - 2008-11-08 17:28:45 --&gt; File loaded: /Users/joeymarchy/Sites/apol0829/app/apol0829/application/views/template/header.php
ERROR - 2008-11-08 17:28:45 --&gt; Severity: Notice --&gt; Undefined variable: course_id /Users/joeymarchy/Sites/apol0829/app/apol0829/application/views/course_add_upload.php 24
DEBUG - 2008-11-08 17:28:45 --&gt; File loaded: /Users/joeymarchy/Sites/apol0829/app/apol0829/application/views/template/footer.php
DEBUG - 2008-11-08 17:28:45 --&gt; File loaded: /Users/joeymarchy/Sites/apol0829/app/apol0829/application/views/course_add_upload.php
DEBUG - 2008-11-08 17:28:45 --&gt; Language file loaded: language/english/profiler_lang.php
DEBUG - 2008-11-08 17:28:45 --&gt; Final output sent to browser
DEBUG - 2008-11-08 17:28:45 --&gt; Total execution time: 0.0584



Here is the code from do_upload()

Code:
$config['upload_path'] = './uploads/course_icons/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['encrypt_name'] = 'TRUE';
        $config['max_size']    = '500000';
        $config['max_width']  = '1600';
        $config['max_height']  = '1200';

        $this->load->library('upload', $config);
        
        if ( ! $this->upload->do_upload())
        {
            $data['error'] = array('error' => $this->upload->display_errors());
            $this->load->view('course_add_upload', $data);
        }    
        else
        {
            $data = array('upload_data' => $this->upload->data());
            $this->coursemodel->updateIcon($course_id, $data['upload_data']['file_name']);
            redirect('course/view/'.$course_id, 'location');
        }
#2

[eluser]zimco[/eluser]
Wild stab at this: but could it be a file permissions problem on the failing to upload files? The "failed to open stream...permission denied" error notice in your log makes me think you need to do some type of chmod on the problem files to get the proper permissions set on the file.
#3

[eluser]Joey Marchy[/eluser]
Good thinking. I compared the permissions of files that upload fine with those that don't and both are 644.
#4

[eluser]zimco[/eluser]
Hmmm. That is weird, thought for sure it had something to do with permissions from what the error log was saying.

Anyhow, I can tell you that i downloaded the file you attached as a problem file and using the simple upload controller/view found in the CI User Guide i had no problem uploading the file to my server. So, i don't think it is a problem with the file.

The other error it is showing: undefined variable course_id. is something to look at, is it undefined because the file did not upload properly or is there a problem elsewhere in your code? $this->coursemodel->updateIcon($course_id, $data['upload_data']['file_name'])
#5

[eluser]Joey Marchy[/eluser]
Thank you, I'll look into that also. Once I figure it out I'll post about it here.
#6

[eluser]Tobz[/eluser]
Hi Joey,

did you ever find out what was going on here?

Cheers
#7

[eluser]Joey Marchy[/eluser]
Tobz,

This was an issue with my local development environment. When I uploaded my files to the web host, everything worked fine. If you are getting this error and developing locally, try it on your web host. I never figured out why I was getting the error message in my local environment. Let me know if you have any other questions.




Theme © iAndrew 2016 - Forum software by © MyBB