I am facing a problem, don't know either this is the server problem or in my coding. The problem is that when i make some changes(insert, update, delete) in database along with uploading images i get an error say [sitename] is currently unable to handle this request. But if i make any transaction without image uploading everything goes fine.
But there is another thing because of that i am confused is that my site has an admin panel also, if i upload images and data from user end every thing works but if i upload the data along with images gives an error. Don't know where the problem is. Either it is at server side problem or in my code.?
Following is the code that is being used at user end.
public function partner_register() {
$date = date('Y/m/d');
$this -> form_validation -> set_rules('contact', 'person contact', 'required|xss_clean');
$this -> form_validation -> set_rules('company', 'company name', 'required|xss_clean');
$this -> form_validation -> set_rules('ph', 'phone', 'required|xss_clean');
$this -> form_validation -> set_rules('email', 'email', 'required|valid_email|is_unique[partner.email]|max_length[100]|xss_clean');
$contact = $this -> input -> post('contact');
$email = $this -> input -> post('email');
$phone = $this -> input -> post('ph');
$name = $this -> input -> post('company');
$brand = $this -> input -> post('brand');
if($brand == null or empty($brand) or $brand == "") {
?> <script> alert('Select atleast one brand');
window.location = "<?php echo base_url('register'); ?>";
</script>
<?php
}
else if ($this -> form_validation -> run() == FALSE) {
?> <script> alert('Email already exists. Please try new email.');
window.location = "<?php echo base_url(); ?>";
</script>
<?php
}
else {
$info = $this -> Parts_Model -> partner_register([
'contact' => $contact,
'email' => $email,
'company' => $name,
'phone' => $phone,
'reg_date' => $date,
]);
if($info) {
foreach($brand as $key => $value) {
$brands = $this -> Parts_Model -> partner_brands([
'partner_id' => $info,
'brands' => $value,
]);
}
if($brands) {
?> <script> alert('Subscription successfull.'); window.location = "<?php echo base_url('register'); ?>"; </script> <?php
}
}
else {
?> <script> alert('Subscription failed.'); window.location = "<?php echo base_url('register'); ?>"; </script> <?php
}
}
}
And here is the code which is being used at backend, both are almost same.
public function add_ads() {
$this -> header_template();
$this -> form_validation -> set_rules('link', 'ad link', 'required|xss_clean');
$this -> form_validation -> set_rules('schedule', 'start date', 'required|xss_clean');
$this -> form_validation -> set_rules('end_schedule', 'end date', 'required|xss_clean');
$link = $this -> input -> post('link');
$schedule = $this -> input -> post('schedule');
$end_schedule = $this -> input -> post('end_schedule');
$config['upload_path'] = 'ads/';
$config['allowed_types'] = 'jpg|jpeg|png';
$config['encrypt_name'] = true;
$this -> load -> library('upload', $config);
if($this -> form_validation -> run() == false) {
echo validation_errors();
}
else {
if(!$this -> upload -> do_upload('ad')) {
?> <script> alert('<?php echo $this -> upload -> display_errors(); ?>'); window.location = "<?php echo base_url('dashboard/ads'); ?>"; </script> <?php
}
else {
$data = $this -> upload -> data();
if($data['file_name'] and $data['full_path']) {
$file_name = $data['file_name'];
$file_path = $config['upload_path'].$file_name;
$info = $this -> Dashboard_Model -> add_ads([
'add_link' => $link,
'schedule' => $schedule,
'end_schedule' => $end_schedule,
'ads' => $file_path,
]);
if($info) {
?>
<script> alert('Added Successfully.'); window.location = "<?php echo base_url('dashboard/ads'); ?>"; </script>
<?php
}
else {
echo 'Error! While adding brands.';
}
}
}
}
}
And here is the server error
And Here are the server log errors