• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error service unavailable

#1
Hi
When i try upload file to server,occur error service unavailable
When i comment upload file code,i dont see error "service unavailable"
Why?
Reply

#2
Have you tried a smaller file? If it works change the limits.

php.ini
upload_max_filesize
post_max_size

PS. We don't own magic 8 balls, so we ALWAYS need code, settings and error logs. How are we supposed to give a correct answer based on that?
Reply

#3
(05-17-2018, 08:32 AM)jreklund Wrote: Have you tried a smaller file? If it works change the limits.

php.ini
upload_max_filesize
post_max_size

PS. We don't own magic 8 balls, so we ALWAYS need code, settings and error logs. How are we supposed to give a correct answer based on that?

Yes you are right but my code is big and cannot publish here
Can i change this flag in .htaccess file?
Actually i think there is error in my code but codeigniter not show it and only show error unavailable

The part of my code
PHP Code:
if (!validate_string($textCONS_MAX_LENGTH_TEXT))
                return array(
'status' => FALSE'result' => CONS_INVALID_TEXT);

            if (!
$this->ExistSubject($subject_id))
                return array(
'status' => FALSE'result' => CONS_NOT_FOUND);

            if (!
validate_json_array($careers))
                return array(
'status' => FALSE'result' => CONS_INVALID_ARRAY);

            if (!
validate_string($answer1CONS_MAX_LENGTH_SUBJECT))
                return array(
'status' => FALSE'result' => CONS_INVALID_TEXT);

            if (!
validate_string($answer2CONS_MAX_LENGTH_SUBJECT))
                return array(
'status' => FALSE'result' => CONS_INVALID_TEXT);

            if (!
validate_string($answer3CONS_MAX_LENGTH_SUBJECT))
                return array(
'status' => FALSE'result' => CONS_INVALID_TEXT);

            if (!
validate_string($answer4CONS_MAX_LENGTH_SUBJECT))
                return array(
'status' => FALSE'result' => CONS_INVALID_TEXT);

            if (
$correct_answer != '1' && $correct_answer != '2' && $correct_answer != '3' && $correct_answer != '4')
                return array(
'status' => FALSE'result' => CONS_INVALID_ANSWER_NUMBER);

            if (
validate_upload('picture')) {

                if (!
validate_picture($_FILES['picture']['tmp_name']))
                    return array(
'status' => FALSE'result' => CONS_INVALID_PICTURE);

                if (!
validate_upload_filesize($_FILES['picture']['tmp_name'], CONS_MAX_SIZE_PICTURE))
                    return array(
'status' => FALSE'result' => CONS_INVALID_FILE_SIZE);

            }

            
$this->db->trans_start();
            
$this->db->set('sUsername',$current_user);
            
$this->db->set('sSubject',$subject);
            
$this->db->set('sText',$text);
            
$this->db->set('sSubjectTypeID',$subject_id);
            
$this->db->set('sCareerID',$careers);
            
$this->db->set('sAnswer1',$answer1);
            
$this->db->set('sAnswer2',$answer2);
            
$this->db->set('sAnswer3',$answer3);
            
$this->db->set('sAnswer4',$answer4);
            
$this->db->set('sCorrectAnswer',$correct_answer);
            
$this->db->insert('questions');
            
$id =   $this->db->insert_id();
            
$this->db->trans_complete();

            if (
$this->db->trans_status() == TRUE) {

                
$path   =   CONS_QUESTION_DIRECTORY.$id;
                @
mkdir($path);

                if (
validate_upload('picture')) {

                    
move_upload_files($_FILES['picture']['tmp_name'], $path '/1.jpg');

                    
$this->db->set('sHavePicture','1');
                    
$this->db->where('sID',$id);
                    
$this->db->update('questions');

                }

                
$this->load->model('user');
                
$this->user->ChangeLevel($current_user,5);

                return array(
'status' => TRUE);

            } else {
                return array(
'status' => FALSE'result' => CONS_INVALID_ADD);
            } 

Reply

#4
PHP Code:
$this->db->trans_start();
$this->db->query('AN SQL QUERY...');
$this->db->query('ANOTHER QUERY...');
$this->db->trans_complete();

if (
$this->db->trans_status() === FALSE)
{
 
       // generate an error... or use the log_message() function to log your error


See if the transaction's are giving you the error.

Usually that error means that the web server is unavailable...
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply

#5
(05-18-2018, 04:20 AM)InsiteFX Wrote:
PHP Code:
$this->db->trans_start();
$this->db->query('AN SQL QUERY...');
$this->db->query('ANOTHER QUERY...');
$this->db->trans_complete();

if (
$this->db->trans_status() === FALSE)
{
 
       // generate an error... or use the log_message() function to log your error


See if the transaction's are giving you the error.

Usually that error means that the web server is unavailable...

OK let me to try it
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.