• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
forbidden access 403 application/views/upload_form.php

#1
hello, im a student n just started using codeigniter to develop a website using codeigniter 3.1.6 and xampp

i got forbidden access error when accessing upload_form.php, can someone help ? 

here's my apache config
Quote:<Directory "C:/xampp/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.


    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

here's my code
main.php in application/views
Code:
<nav class="w3-sidebar w3-red w3-collapse w3-top w3-large w3-padding" style="z-index:3;width:300px;font-weight:bold;" id="mySidebar"><br>
 <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-hide-large w3-display-topleft" style="width:100%;font-size:22px">Close Menu</a>
 <div class="w3-container">
   <a href="application/views/upload_form.php"><h3 class="w3-padding-64"><b>Arnold<br>Cells</b></h3></a>
 </div>

upload_form.php in application/views
PHP Code:
<html>
<
head>
<
title>Upload Form</title>
</
head>
<
body>

<?
php echo $error;?>

<?php echo form_open_multipart('upload/do_upload');?>

<input type="file" name="userfile" size="20" />

<br /><br />

<input type="submit" value="upload" />

</form>

</body>
</html> 

upload.php in application/controllers
PHP Code:
<?php

class Upload extends CI_Controller {

 
       public function __construct()
 
       {
 
               parent::__construct();
 
               $this->load->helper(array('form''url'));
 
       }

 
       public function index()
 
       {
 
               $this->load->view('upload_form', array('error' => ' ' ));
 
       }

 
       public function do_upload()
 
       {
 
               $config['upload_path'         './uploads/';
 
               $config['allowed_types'       'gif|jpg|png';
 
               $config['max_size'            100;
 
               $config['max_width'           1024;
 
               $config['max_height'          768;

 
               $this->load->library('upload'$config);

 
               if ( ! $this->upload->do_upload('userfile'))
 
               {
 
                       $error = array('error' => $this->upload->display_errors());

 
                       $this->load->view('upload_form'$error);
 
               }
 
               else
                
{
 
                       $data = array('upload_data' => $this->upload->data());

 
                       $this->load->view('upload_success'$data);
 
               }
 
       }
}
?>
Reply

#2
Your cross-post of this question on Stack Overflow has the answer.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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