MrD
MrD

Reputation: 5086

Failure to open file

I have a file residing in:

/public_html/funding_manager/application/uploads

called Funding_calendar_05_Dec_14.ics

I am trying:

fopen("/public_html/funding_manager/application/uploads/" . $upload_data['file_name'], 'r'

From within a Codeigniter conroller method but I get gold the file can't be found.

/public_html/funding_manager/application/uploads/Funding_calendar_05_Dec_1414.ics

I can't seem to get my head around this...

Any thoughts?

Upvotes: 0

Views: 129

Answers (1)

jogesh_pi
jogesh_pi

Reputation: 9782

FCPATH should work great to get the absolute path of the file.

fopen( FCPATH."/application/uploads/" . $upload_data['file_name'], 'r' ) 

instead of hardcoded

fopen("/public_html/funding_manager/application/uploads/" . $upload_data['file_name'], 'r'

Upvotes: 1

Related Questions