Jump to content

ConfigureWEB

New Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by ConfigureWEB

  1. The issue seems to be that glob() function is not working on that server. No idea if it is disabled or if it can be disabled somehow. If you have any ideas, please share with me. Thanks.
  2. Why? There is the echo 'No projects found.'; which should output when there is no projects in the "projects" folder, but it doesn't output anything.
  3. Hi, I have the following code in my application and it is not working on a certain VPS server and I have no idea why. Server: Linux - PHP Version 5.3.16 <?php define('PROJECTS_DIR', '../projects/'); // Gets project names from the projects folder. function projects() { $projects = glob(PROJECTS_DIR.'*', GLOB_ONLYDIR); for ($i=0; $i<count($projects); $i++) { $projects[$i] = basename($projects[$i]); } return $projects; } $projects = projects(); if (empty($projects)) { echo 'No projects found.'; } ?> The above code works fine on all other servers I tested but not on this one. No error, no output. What could be the reason? What should I check in phpinfo() or php.ini? Something to do with glob()? Thanks for any ideas.
  4. Hi, I am trying to create and download a .zip archive from a folder that contains files and folders in it. I have the following code which works for folders that has only files in it but it doesn't work for folders that contain subfolders. <?php $dir = 'sample'; $archive = 'sample.zip'; $zip = new ZipArchive; $zip->open($archive, ZipArchive::CREATE); $files = scandir($dir); unset($files[0], $files[1]); foreach ($files as $file) { $zip->addFile($dir.'/'.$file); } $zip->close(); header('Content-Type: application/zip'); header('Content-disposition: attachment; filename='.$archive); header('Content-Length: '.filesize($archive)); readfile($archive); unlink($archive); ?> When I run the above code, a .zip archive is created and downloaded but it doesn't open. How should I change it so that it will work for folders that contain files and subfolders? Thanks.
×
×
  • 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.