Receive unexpected output from TCPDF - laravel

I am using TCPDF with Laravel.
while using $tcpdf->Output() it showing me some object of tcpdf
Output:
This is what I got as output

That is the content of the pdf file that was created. If you give $tcpdf->Output('myfile.pdf','F') it will put all that content in the file 'myfile.pdf' on your server. If you want the file to be downloaded as soon as it is created you need to just specify the filename eg. $tcpdf->Output('myfile.pdf').
For more detail read https://tcpdf.org/docs/srcdoc/TCPDF/classes-TCPDF/#method_Output

Related

Swift_IoException: Unable to open file for reading from a public url

I am trying to attach a pdf to an email generated using SwiftMailer on Laravel. The pdf is at a publicly accessible location, but I get this error:
Swift_IoException(code: 0): Unable to open file for reading [https://www.mynewdomain.com/myfile.pdf]
Previously this file was accessed with https://www.myolddomain.com/myfile.pdf which still works - the file can be attached correctly. The new domain was set up and the file can be accessed using it through a browser, but for some reason swiftmailer throws this error when trying to read it.
The storage location of the file hasn't been changed. The only new thing is the domain the nginx config which is the same as the old, with the new domain name.
Is there a reason why this wouldn't be working?
Thanks,

Strapi endpoint for all media uploads

Does anyone know the endpoint for getting all of the iamges you uploaded to the media libray in one request?
Im using next js with strapi and need a way to grab all of the images from the media library but there doesnt seem to be any documentation on this
/api/upload
GET /api/upload/files Get a list of files
GET /api/upload/files/:id Get a specific file
POST /api/upload Upload files
DELETE /api/upload/files/:id Delete a file
Reference
https://docs.strapi.io/developer-docs/latest/plugins/upload.html#configuration
GET /upload/files
You can read more on the docs

After downloading zip folder the code next to it is not working

I am working with PHP code igniter i wrote below code to download the file.
Which reads file and download it as zip. It working fine. But when i write other code below download it stop working. For example if i echo the sum two digit it wont work. Will any one guide me on this.
$this->zip->read_file($path);
$filename= "zip-name";
$done = $this->zip->download($filename);
//Below code not working
$a=10;
$b=10;
echo $a+$b;
That's intended behaviour. See the hint in Codeigniter Docs for that function:
Do not display any data in the controller in which you call this method since it sends various server headers that cause the download to happen and the file to be treated as binary.
That's why download platforms typically do a delayed, JavaScript controlled redirect ("Your Download will start shortly..")

Cannot get file name Fineuploader

I cannot get the file name when listening for the onProgress event. The file id is available along with the file progress uploaded bytes and total bytes. Please help me to get the file name if available.
You can either ensure you are using Fine Uploader 5.0.4 or newer, where this issue was fixed, or you can use the getName API method:
uploader.getName(id);

The file name you submitted already exists on the server

Most of the time I upload an image I get an error which says "The file name you submitted already exists on the server". I am using codeigniter version 2.1.0.
Please help regarding how can I fix this.
Thanks
Please enable encrypt_name, find more here
$config['encrypt_name'] = TRUE;
By this line you are telling codeigniter to create (pseudo) random filname for your file therefore your file is going to be unique (in name matter).
Furthermore you can create such a system that uploads files in folders, consider following folder structure:
/files/pictures/<date_of_upload>/<random_string>_big.jpg
/files/pictures/<date_of_upload>/<random_string>_thumb.jpg

Resources