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

  • SEARCH
  • Home
  • 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 8460125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:31:12+00:00 2026-06-10T13:31:12+00:00

I created exact same copy as CI User Guide , I even changed $this->upload->do_upload(name_of_file_input);

  • 0

I created exact same copy as CI User Guide, I even changed
$this->upload->do_upload("name_of_file_input");
I tried both

./data/
./application/data/

as my folder to upload, CHMOD 0777, and still upload does not work.
I started FF and FireBug to see what headers I am sending/getting from my localhost and I figured that problem could be in .htaccess file but no so sure…

I work on subfolder localhost/something/ (or http://192.168.0.101/sms/)
my routes.php should be fine well no 404s or any other problems besides upload script

Also weird thing is I have to make form like this

<?=form_open_multipart("/sms/upload/do_upload")?>

which creates this

<form action="http://localhost/sms/sms/upload/do_upload" method="post" accept-charset="utf-8" enctype="multipart/form-data">

note double sms/sms/ which is obviously wrong, but my htaccess it redirects correctly as you can see here

HTTP/1.1 301 Moved Permanently
Date: Tue, 28 Aug 2012 01:49:47 GMT
Server: Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4
Location: http://192.168.0.101/sms/upload
Content-Length: 337
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

if I create form like this

<?=form_open_multipart("/upload/do_upload")?>

it throws me a error well of course it does

HTTP/1.1 301 Moved Permanently
Date: Tue, 28 Aug 2012 01:52:43 GMT
Server: Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4
Location: http://192.168.0.101/upload/do_upload

and obviously http://192.168.0.101/upload does not exist on my localhost my whole installation is under subfolder /sms/

my .htaccess

<IfModule mod_rewrite.c>
# mod_rewrite rules
RewriteEngine on

# The RewriteBase of the system (if you are using this sytem in a sub-folder).
 RewriteBase /sms/

# This will make the site only accessible without the "www."
# (which will keep the subdomain-sensive config file happy)
# If you want the site to be accessed WITH the "www."
# comment-out the following two lines.
 RewriteCond %{HTTP_HOST} !^192.168.0.101$ [NC]
 RewriteRule ^(.*)$ http://192.168.0.101/$1 [L,R=301]

# If a controler can't be found - then issue a 404 error from PHP
# Error messages (via the "error" plugin)
# ErrorDocument 403 /index.php/403/
# ErrorDocument 404 /index.php/404/
# ErrorDocument 500 /index.php/500/

# Deny any people (or bots) from the following sites: (to stop spam comments)
# RewriteCond %{HTTP_REFERER} nienschanz\.ru [NC,OR]
# RewriteCond %{HTTP_REFERER} porn\.com
# RewriteRule .* - [F]
# Note: if you are having trouble from a certain URL just
# add it above to forbide all visitors from that site.

# You can also uncomment this if you know the IP:
# Deny from 192.168.1.1

# If the file is NOT the index.php file
RewriteCond %{REQUEST_FILENAME} !index.php
# Hide all PHP files so none can be accessed by HTTP
RewriteRule (.*)\.php$ index.php/$1

# If the file/dir is NOT real go to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

</IfModule>

# If Mod_ewrite is NOT installed go to index.php
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>

#<ifModule mod_expires.c>
#  <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|js|css|swf)$">
#       ExpiresActive on
#       ExpiresDefault "access plus 1 year"
#   </filesmatch>
#</ifModule>

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/xhtml text/html text/plain text/xml
text/javascript application/x-javascript text/css
</IfModule>
FileTag none

NEW info:

it seems that after hitting “upload” button it is redirected “somewhere” (with data “attached”), and from “somewhere” it is redirected to my actual upload script that does all the work (without data “attached”) therefore I think it is problem of .htaccess.
CI throws this error

You did not select a file to upload.

<?php

class Upload extends CI_Controller {

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

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

function do_upload()
{
    $config['upload_path'] = './data/';
    //$config['allowed_types'] = 'gif|jpg|png';
    //$config['max_size']   = '100';
    //$config['max_width']  = '1024';
    //$config['max_height']  = '768';
    //$config['file_name'] = $_FILES['userfile']['name'];
    $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);
    }
   }
  }
 ?>

it is copy of CI guide I linked above

  • 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-10T13:31:14+00:00Added an answer on June 10, 2026 at 1:31 pm

    finally 🙂
    the problem was in relative / absolute paths or actually my CodeIgniter settings, there is this line in my config.php

    $config['base_url'] = 'http://localhost/sms/';
    

    which is all good, but in my .htaccess file there is no localhost mentioned (there is IP).

    The whole problem is solved by putting same “path” in both config files and .htaccess file

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

Sidebar

Related Questions

I need to create an exact copy of data stored within a database. We're
I'm having the exact same problem as in this question: Gray border when using
Created .NET WCF service, tested it - works. Generated schemas from Data and service
Out of curiosity, I've created 2 assemblies which both have a class ( Class1
I want to create an exact copy of a file(.bmp) in c #include<stdio.h> int
I have an upload/download web service that I created with WCF. Im using c
I am having problem in writing copy constructor for pointers to objects. This is
(using SS2008) Within a sql server database, I'd like to copy all the data
I use this code to copy and instance of my class //Create the copy
Today I tried to include some videos for cutscenes but I failed on even

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.