I try to download a PDF file from a server. The download is successful, but I get this error when I open the file in Adobe Reader:
When I try to download file manually from the server, it works.
Code to download the file based on CodeIgniter framework:
function downloadFile($file){
force_download('assets/img/file/'.$file, NULL);
}
What am I missing here?
function downloadFile($file){
$this->load->helper('download');
force_download('assets/img/file/'.$file, NULL);
}
If you don't load the download helper, the force_download function will not be available, thus generating a PHP error which ends up being a corrupt downloaded file
Related
So,i've been having problems with integrating file manager to TinyMCE 5,uploading images into a specified folder using the file manager works without any issues,that is also true for deleting the images,but the problem is when you try to use the images,they appear as blank and if you open a console you will see error 404 messages that images don't exist
The solution that worked for me is that i went to .env file which is inside of your laravel project and then changed this line of code which is usually located in the first few lines of the file:
APP_URL=http://localhost
to this
APP_URL=http://127.0.0.1:8000
It seems like file manager uses APP_URL to build the URL for some reason,still haven't found out why tho
I am using the Dompdf package in Laravel to download pdf's. I have the following in my web.php:
Route::get('proposal-pdf/{id}', function($id) {
$proposal = Proposal::find($id);
// $pdf = PDF::loadView('test', compact('proposal'));
$pdf = PDF::loadView('internal-admin-tools.proposal-pdf', compact('proposal'));
return $pdf->download('proposal.pdf');
return back();
});
I downloaded Dompdf using: composer require barryvdh/laravel-dompdf.
I have a view using fonts that come with Laravel. I get the following error:
fopen(C:\xampp\htdocs\HealthHub\storage\fonts/\176125b1b6dc4704cbf0390040859779.ufm): failed to open stream: No such file or directory
I added the 'fonts' directory in my 'storage' and then added the file named above. After I do that and reload, the load does not render. I think I may have to change the permissions to my 'fonts' folder and cannot find any clear answer here on how to do that. I have not done that before. I am using VSCode and XAMPP. I navigated to the 'fonts' folder in the terminal and entered: chmod mode 777. It says 'chmod' isn't recognized
Creating storage\fonts directory should fix the problem.
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
I am Using DomPDF for developing pdf in Codegniter GIving Error
require_once(): Failed opening required 'C:/xampp/htdocs/manisha/application/helpers/dompdf/lib/php-font-lib/classes/Font.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\manisha\application\helpers\dompdf\dompdf_config.inc.php on line 332
It seems your include fails. Please check the file permissions and if the "Font.php" file is actually at:
C:/xampp/htdocs/manisha/application/helpers/dompdf/lib/php-font-lib/classes/Font.php
Also, check if it works when you change "require_once()" into "require()", if so, you probably trying to include that file multiple times.
I have upgraded my Magento version from 1.4.0.1 to 1.7.0.2.
Now I tried to upload a theme package using upload package file in Magento Connect Manager. It shows an error 'No file was uploaded'.
Please get me a solution.
Try using the Version 2.0 from the dropdown on the extensionpage on magento-connect, that should work.
The No file was uploaded error is return when:
The form key is invalid
$_FILES doesn't exist
$_FILES['file'] is empty
I had the same issue and managed to fix it by commenting out the rewrite instructions in my main .htaccess file in Magento's root folder. Don't forget to add those instructions back after you finished installing your module.
I suggest you keep a .htaccess.magento-connect file for when you want to use Magento Connect along with your regular .htaccess file, and switch between the two.