Jump to content

Search the Community

Showing results for tags 'readfile'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 5 results

  1. Hello, I have one big XML file (600 MB - 850 MB) in format "cells_yyyymmdd_hhmi.xml" I would like to specify that everyday i will have new file with new date. So, there should be general way to rea For exmaple, i have file of 7th January. Its, cells_20140107_154016 Goal is to split into small parts by shell script and do operation.
  2. Hello, I have one tar.Z file. I have to run shell script daily as it is required to update the database. customer_yyyymmdd_hhmi.tar.Z sales_ yyyymmdd_hhmi.csv (5 MB - 20 MB) purchase_ yyyymmdd_hhmi.xml (650 MB - 950 MB) I have made small part of XML file. There are 4 parts. There is PHP Script which is working but i need to change each time file like PART1.xml, PART2.xml etc. Things to do: 1) Extract tar.Z file and Read CSV and XML file. 2) Read whole XML file automatically. I hope i am clear. Thanks in advanced for your time and input.
  3. I've set up a Download-Script with PHP on my server, which checks some details before letting the user download files via Apache (X-Sendfile). The Files are outside the Document-Root. The code for downloading with Apache and the Module X-Sendfile is: header("X-Sendfile: $fullpath"); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"$link_file\""); When using Apache and X-Sendfile i have a download-speed of 500 kB/s with my client. I also tested it with Apache and without X-Sendfile with the same file within the Document Root - same thing here! So I tested downloading the same file, with the same client, the same infrastructure on both sides and the same internet-connection a few seconds later via PHP with readfile: header("Pragma: no-cache"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/octet-stream"); header("Content-Length: ".(string)(filesize($fullpath))); header("Content-Disposition: attachment; filename=\"$link_file\""); readfile($fullpath); This time the download-speed was 9.500 kB/s! I repeated this test using both options more than a multiple times and the result was the same every time trying. The only difference besides the download-speed was a waiting time of a few seconds (depending on the size of the file which was downloaded), when trying with the PHP readfile method. When repeating the PHP readfile method instantly, the waiting time didn't appear again. Most likely because it was stored in the memory after the first time. I'm using a professional HP Raid-System on the server, which has an average local Speed of 800 MB/s, so the reason for this can't be the Diskspeed. Also i didn't find any compressing- or bandwith-settings in the httpd.conf of Apache. Can anyone of you explain why there is such a great difference of the download-speed and how this can be changed? Thank you in advance. Server: Windows Server 2008 R2 Apache/2.2.21 (Win32) PHP/5.4.20 Client: Windows 7 Ultimate x64 Google Chrome 30.0.1599.101 LAN >100 Mbit/s
  4. Hi! I have tried to add this link to the player under file:"sales/getfFile.... But it its saying bad source. When this code pasted on the address bar , i can download the file..... But the player cannot. $VideoF= stripslashes($_GET['download_file']); $VideoIm = preg_replace('/\.[^.]+$/','',$VideoF); if(isUserLoggedIn()) { ?> <script type="text/javascript" src="jwplayer/jwplayer.js"></script> <script type="text/javascript" src="jwplayer/jwplayer.html5.js"></script> <div id="myElement">Loading the player...</div> <script type="text/javascript"> jwplayer("myElement").setup({ file: "sales/getfFile.php?download_file=<?php echo $VideoF; ?>", image: "sales/assets/img/history/<?php echo $VideoIm; ?>.jpg" }); </script> <?php } ?> the download script is : $path_parts = pathinfo($_GET['download_file']); $file_name = $path_parts['basename']; $fullPath = "../privatefolder/".$file_name; if ($fd = fopen ($fullPath, "r")) { $fsize = filesize($fullPath); $path_parts = pathinfo($fullPath); $ext = strtolower($path_parts["extension"]); switch ($ext) { case "pdf": header("Content-type: application/pdf"); // add here more headers for diff. extensions header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download break; case "mp4": header("Content-type: video/mp4"); // add here more headers for diff. extensions header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download break; default: header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); } header("Content-length: $fsize"); header("Cache-control: private"); //use this to open files directly while(!feof($fd)) { $buffer = fread($fd, 2048); echo $buffer; } } fclose ($fd); exit; Do you guys have netter way of playing videos outside root directory?
  5. I can't figure out how to combine readfile() with <pre> tags so that the \n linebreaks in my text file are displayed properly. // works but doesn't print line breaks echo readfile("filename.txt"); // doesn't work -- parse error echo "<pre>readfile("filename.txt")</pre>"; // doesn't work -- parse error echo "<pre>{readfile("filename.txt")}</pre>\n"; Any tips to solve this?
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.