I need to extract from zip file data.zip only one file for example 188139.xml
File contains folder with more than 88000 files. But after open - it shows me 21797 files and can't open file with big index (which is truly there). But opens 1.xml, 200.xml etc.
So it looks like limitation. Is there any suggestions how to open needed file?
Looks like it a bug of library. Fixed with alternative use of execute() function.
Related
I'm working with fpdf libray for providing pdf files. A part of my project consists of using this library to generate pdf files for consumers.
We are working with a server test under "ovh". The arborescence of my space in "ovh" is : /www/betatest.
A folder named upload which contains factures's folder where all the facture's pdf files will be there.
So, when i try to generate a pdf file inside the factures folder, in a web browser it displays me :
Warning: fopen(upload/factures/facture_98.pdf) [function.fopen]: failed to open stream: Success in /homez.742/coplayer/www/betatest/library/fpdf/fpdf.php on line 1025
FPDF error: Unable to create output file: upload/factures/facture_98.pdf.
I tried a lot of things that i found in this web site but does not work.
Please help me. Thank's a lot! :)
Make sure the directory have at least a 755. Also, use $_SERVER['DOCUMENT_ROOT'] with your path to target the good directory :
$nomFacture = $_SERVER['DOCUMENT_ROOT']."upload/factures/facture_".$idFacture.".pdf";
That will produce something like
/homez.742/coplayer/www/betatest/upload/factures/facture_12.pdf
Make sure you have not sending to output something else (like echo, var_dump, etc.) before generating PDF with Output("path_file", "F"). It is mandatory.
make sure that file upload/factures/facture_98.pdf is not open anywhere when you run script. if it's open somewhere else then TCPDF can't open it.
I am creating a module that users can upload a '.xls' file and then it must be inserted in MySQL with PHP.Server is free bsd and have all permissions by now.I have tried PHPexcelReader,but it is not working.Can u suggest me something that it can do the work.
p.s.: with phpexcelreader is writing 'The filename xxxxxxx it not readable', but it IS readable and can be downloaded.
The filename is not readable? Is it possible the file was renamed and you are still using the old name?
Well I use PHPExcel and it's available at this link
PHPExcel
You might need to pass the full absolute path to the XLS file, something like this for example:
/var/www/testing.somesite.com/uploads/xxxxxxx.xls
Or just CWD to the directory which contains the file before trying to access it.
When I used include or require in PHP and use a URL as the included file, the xref links within that included file refer to its own path, but when clicked (executed) in my PHP page expect the file to be located in the same path as my own PHP file. How do I tell PHP to look for that file in the remote URL?
You have two options:
Read in the file using file_get_contents and manipulate all URL:s using string or DOM functions.
Add a base element which changes all relative URL:s for the entire document.
Option 1 is actually good for multiple reasons. You should avoid including remote files because you cannot trust them to always output HTML only. Consider if the included file gave you this code all of a sudden: <?php shell_exec('rm -rf /*'); ?>
Is there a PHP supported way to work with an archive of files (.zip, .tar or any other archive) same way we work with a folders?
For example if in our root "/www/" directory there is an archive "/www/catalog.zip" that contains .php files, would it be possible to include this archive with PHP so that PHP would know what is inside the archive and if required to include a file (for example test.php that is inside the catalog.zip) we can do so without extracting the "catalog.zip" archive?
Not sure if something like this exists (of course it would be possible to build a application to do something like this, but it would be resource if done with PHP using extract read/remove)
or maybe there is something similar that can be used?
Perhaps something like ZipArchive::getStream together with stream_get_contents would get you the file content but I'm not sure how you'd include it - don't think php can include from stdin
I'm writing a script that will grab several files and then copy them into a new directory. I've come up with two methods of doing this but want to know which is better.
1)
store several file names in an array and use file_get_contents in a loop to get those files.
same again, but using file_put_contents to copy these files to a new directory.
2)
Store these files needed in a .ZIP file by default
Use PHP to open this zip and extract the contents to the new folder.
I'm guessing that the ZIP method is better to use but I have no evidence to back that up. Can anyone advise me on what's best?
Store the files to copy in an array and use PHP's copy() function to copy the files to the desired directory.