Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8049549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:48:51+00:00 2026-06-05T06:48:51+00:00

I have a controller with the method ‘do_upload’ which should upload an image to

  • 0

I have a controller with the method ‘do_upload’ which should upload an image to /img but instead I’m getting the following error:

http://localhost/img/

The upload path does not appear to be valid.

This is the method of the upload class.

public function do_upload(){

        $config['upload_path']= "http://localhost/img/";
        $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()){
            $errors=array('errors'=>$this->upload->display_errors());
            echo $config['upload_path'];
            $this->load->view('error',$errors);
        }

        else{

            $data=array('upload_data'=> $this->upload->data());

            $this->load->view('admin/admin');
        }
    }

The file permissions are set to the following (to test this works!):

drwxrwxrwx

However, if I direct my browser to http://localhost/img/ I am able to view the contents of the directory so I don’t think it’s a permission issue. Is there something I’m doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:48:52+00:00Added an answer on June 5, 2026 at 6:48 am

    You cannot upload to a URL. $config['upload_path'] must be a path to a filesystem location on your server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following spec to test controller method: context #create do it should redirect
I have a controller method with the following signature: [AcceptVerbs(HttpVerbs.Post)] public ActionResult UpdateValues(int id,
I´m getting a lazy initialization exception. A have a controller method with the annotation
I have the following application_controller method: def current_account @current_account ||= Account.find_by_subdomain(request.subdomain) end Should I
My site is open to all but i have a controller with some method
Is there an annotation/attribute which can be set on a controller method, to have
I have a controller method that acceses a repository method which has lambda expression
Consider I have a controller method get() which calls a few service methods working
i have a little question about getting access to a method in another controller,
I have a controller's method which renders a template. This works fine to render

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.