Upload images in tinymce - codeigniter

I have a question...I using jbimages for upload images with editor tinymce, I set the path like this:
$config['upload_path'] = '/var/www/blog/content';
Server which I use is nginx,the path is corect and I make chmod 777 on the content folder, but when trying to save image I got 404 Not Found nginx/1.1.19.On the apache go ok,images are charged...Help me please.I don't understand where is the problem.Exists a solution?Where is the problem?

I believe that you have defined the base url in config file if not that go to your config file and in that you will see the base url, set it like :
$config['base_url'] = 'http://www.example.com/';
and use the code as follows:
$config['upload_path'] = base_url().'/path/to/your/file';

Related

how can I solve the image uploading issue in laravel on shared hosting without ssh?

i uploaded my laravel project on a shared hosting platform everything is working fine except the image upload feature probably due to the storage:link command issue.is there any alternative for the same
Depending on the output error, it maybe permission issue and ... , but again you can use manual file upload to a folder in laravel like so :
if($request->hasFile('file_input_name')){
$file = $request->file('image');
$name = md5(time()) . '.' . $file->etClientOriginalExtension();
$file->move(public_path('files'),$name);
}
before anything create a folder named files in public folder and set its permission to 755.
Good Luck.
it seems like a permission issue
your last column in the second picture is for permission separated in 3 type
owner-group-other w for write r for reading x for executing
you have to check your images folder permission to accept write permission

Upload files in storage directory in laravel can't write image to data path

I am trying to upload in laravel with intervention image plugin
But get this error. sorry 4 bad english
Can't write image data to path
(E:\xampp\htdocs\my-project\storage\app/medicines/thumbs/medicines/MEmheIamxDfu8ePa1h5mtovKFzY0POJtfGW8BLYZ.jpeg)
if($request->hasFile('photo')) {
$photo = $request->file('photo');
$image = $photo->store('medicines');
$path = storage_path('app/') .$image ;
Image::make($path)->resize(75,75)->save(storage_path('app/medicines/thumbs/'.$image,50));
Error message mean that web server user have no permission to write in that path.
So to fix it:
Change your directory upload path to app/public or app/storage directory
If you want to store in app/storage you can follow Laravel doc
Allow permission to web server(Apache user, etc.) to the path above

How to use SimplePie with Laravel

I am using Laravel 5.2. I need to get RSS feeds using SimplePie, so I install the library through composer.json and now my vendor folder contains simplepie but when i run the following code this error shows:
ErrorException in SimplePie.php line 1379: ./cache is not writeable.
Make sure you've set the correct relative or absolute path, and that
the location is server-writable.
My code in route:
Route::get('feed', function () {
$feed = new SimplePie();
$feed->set_feed_url(array(
'http://www.thenews.com.pk/rss/2/16' //it has no images
));
$feed->init();
$itemCount=$feed->get_item_quantity();
return $itemCount;
});
Create a writeable cache folder for simplepie in the /storage/ folder (I called mine simplepie_cache).
Set the path in your feed object:
$feed->set_cache_location(storage_path() . '/simplepie_cache');
That should do the trick.
check what is saying ./cache is not writeable can't write to cache folder check permissions to this folder or try a L5 wrapper for SimplePie https://github.com/willvincent/feeds

How to open a pdf file which is in views or controller folder in ci?

i have a pdf file in view folder and controller folder by the link i need to access it how to do this i have tried with following by am getting error like
Access forbidden!
$path=base_url()."application/views/users/sample_pdf_report.pdf";
$path2="C:\xampp\htdocs\vacationgod\application\views\users\sample_pdf_report.pdf"
// OPTIONAL - PUT A LINK TO DOWNLOAD THE PDF YOU JUST CREATED
echo ("<a href='$path2'>Download Your PDF</a>");
i have tried both $path and $path2
You probably have a .htaccess file forbidding people to access files in those folders.
You should create a res folder in your site root path and place your pdf file in that folder and link the file from there..
Happy coding :)

Installing a CodeIgniter application in a subfolder

I'm trying to install an application made with codeIgniter in a subfolder, so that I can access it using : http://www.domain.com/my_subfolder/
At the root, there's a Wordpress application.
I edited the .htaccess of the Wordpress install to let the request go to the folder /my_subfolder/
It's working fine, the only problem I get is that CodeIgniter is unable to dynamically load the classes in the "libraries" directory. So everything in the CI application works fine until it tries to use an object declared in the "libraries" subfolder, then I get a : Unable to load the requested class: my_class
It doesn't seems that there's a parameter in the "config" folder to change that... any idea?
What you need is to edit your CodeIgniter config.php in System > application > config.
and then edit config.php and set the property:
$config['base_url'] = "http://www.domain.com/my_subfolder/"
Well it seems that the config param base_url should be updated. Also, I used a library with the "MY_" prefix, and I should'nt since I was'nt extending any CI class.
This is 2021. In case anyone is having this same issue with CodeIgniter 4, this is how I solved it when I came across this issue.
Problem
I installed CI in a subfolder in my public_html folder i.e example.com/api. When I visited www.example.com/api, I saw a 403 forbidden error.
Solution
Download and unzip CI on your local machine or use composer.
Rename public folder to the name of your subfolder. In my case, I named it api.
Create another folder and give it any name of choice, for example, let's use mango (yes, I love mangoes). Copy all the remaining files and folders (app, system, writables, env, LICENSE, README, composer, phpunit, spark) into the mango folder. After doing this, we should have 2 folders: api and mango
Copy both folders to your live server cpanel root (Do not copy into public_html or www). Let them be on the same level as public_html
Open api/index.php and change $pathsConfig = FCPATH . '../app/Config/Paths.php'; to $pathsConfig = FCPATH . '../mango/app/Config/Paths.php';
Create a subdomain and point it to /api
Go to the api folder, duplicate the env file and rename it to .env
Open .env and look for app.baseURL=''. Remove the '#' to uncomment that line and the change it to app.baseUrl='http://subdomain' where subdomain is the subdomain you created above e.g http://api.example.com
Open mango/app/config/App.php and look for public $baseUrl and set it to subdomain e.g $baseUrl = 'http://api.example.com'
Your CI project is now well configured. Visit http://api.example.com. and you should see the CodeIgniter welcome page.

Resources