Welcome Guest, Not a member yet? Register   Sign In
Why i am getting this error? Unable to locate the model you have specified
#1

[eluser]zoreli[/eluser]
Hi

I use latest version of CI, that is 2.1.2.

I upload my demo application in the following location http://www.domainname.com/myfolder/index.php

If i try to open home page, welcome controller is opened correctly. However if I try to open http://www.domainname.com/myfolder/index...nctionname page, I get the following error message:

An Error Was Encountered

Unable to locate the model you have specified: backofficeusersmodel

In my config file, I have the following settings:

$config['base_url'] = 'http://www.domainname/myfolder/';
$config['index_page'] = 'index.php';
I also tried and

$config['base_url'] = 'http://www.domainname.com/myfolder/application/';
$config['index_page'] = 'index.php';

without any success.

However, the model is uploaded and its name is backOfficeUsersModel, not as stated in the error message all lover case.

I would like to mention that I use myModel (uploaded in application/core), and that same strange thing was happening when I upload same application under some free hosting, just there the error was that mymodel could not be located.

I upload same application on different hosting company and there it worked. Also, same application work normally on my localhost.

Anyone had similar experience?

Regards,Zoran
#2

[eluser]zoreli[/eluser]
Hi

I solved my problem with renaming the model in all lover case letters. Just in case that someone run in the same problem.

Regards,Zoran
#3

[eluser]TWP Marketing[/eluser]
The problem is in your naming protocol. From the User Guide:

http://ellislab.com/codeigniter/user-gui...odels.html

"Where Model_name is the name of your class. Class names must have the first letter capitalized with the rest of the name lowercase. Make sure your class extends the base Model class.

The file name will be a lower case version of your class name." [EMPHASIS MINE]

If you use a case sensitive server OS, this is critical and will come back to bite you.
#4

[eluser]zoreli[/eluser]
Hi

Thanks for answering...if I understand you correctly, i did well that I make the file name lower case ,and that is something that I should always do.

Within the class however, I should now correct my code and ensure that class name start with capital letter. Did I understand you correctly? Then I should be fine on any server i guess?

Regards,Zoran
#5

[eluser]TWP Marketing[/eluser]
I took that quote straight out of the User Guide. See the example code there.

I would check the naming of all of your classes in the model directory.

The class name is (Capitalized) and its filename is all lower case.

You should be fine on your server, but keep to the convention since CI does check and chokes when it doesn't match the expected format.




Theme © iAndrew 2016 - Forum software by © MyBB