Welcome Guest, Not a member yet? Register   Sign In
Getting absolute path for uploading a file
#1

[eluser]jaswinder_rana[/eluser]
Hi:

I am trying to upload a file with upload.php CI library. Its giving me wrong upload path error.

My structure is

system
- applicaiton
-- views
public_html
- index.php
- public
-- upload
--- YYYY
---- MMDD

How can I refer to "upload" directory from my controller? My solutions seem to be

- Use absolute path from controller; don't want to make it fix
- Store absolute path in my own config file and include it
- Somehow try to calculate the path automatically

I was hoping that there is a way that I can get my path for index.php (in this case /some/path/public_html). Is there a way in CI to do that?

I don't want to have to change it everytime I change servers with different paths.

Please help
#2

[eluser]mihailt[/eluser]
http://www.php.net/manual/en/function.realpath.php ?
#3

[eluser]John_Betong[/eluser]
 
 
I always echo getcwd();, see what is displayed and set the new path accordingly.
 
 




Theme © iAndrew 2016 - Forum software by © MyBB