• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Problem on save image in public directory

#1
I have the structure below my project:

(private directories)

/home/my_project/App/Controllers/Api/V1/FileController.php

(public directories)

/home/public_html/my_site/assets/images

I'm trying to send an Api file to the / images directory with file_put_contents but I'm not getting it. I've tried with:
file_put_contents (FCPATH. '....');
file_put_contents (APPPATH. '....');
file_put_contents (ROOT. '....');
file_put_contents (__ DIR__. '....');

I tried to change the permissions of the directory from 755 to 777.

And nothing worked.
What is the correct way to do this?
Reply

#2
It would help if we had a little more information, like what is your base url etc.;

Did you try:


PHP Code:
<?= base_url('my_site/assets/images/');?>
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(12-11-2020, 01:13 PM)InsiteFX Wrote: It would help if we had a little more information, like what is your base url etc.;

Did you try:


PHP Code:
<?= base_url('my_site/assets/images/');?>

InsiteFX

Thank you for your support!

But I have to apologize for the carelessness on my part, as I checked the PHP settings and the allow_url_fopen directive was not enabled.
Reply

#4
No problem, it's best to always check your php.ini setting's I redo mine from scratch every time
I install a new version.

Glad you figured it out.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.