There are about 300+ sub directories under constant_path and I can’t chmod all of them. So, the question is, if constant_path is already 777 how do I zip up a file dynamically in constant_path/random_path/random_file.mp3?
Do I have to find the value of that file, MOVE it to another directory, and then zip it from there?
What would you do?
Thanks.
PS. I don’t post code yet as I think it’s more of a logic/usage issue and not a code issue. The function itself is ideal if I zip a file in the same directory as the script doing the zipping.
PPS. I initially tried to zip a FULL Url. Maybe I should just try the file itself using a real path instead of full url, such as
httdocs/constant_path/random_path/random_file.mp3
Basically our users download music but I am offering them an option to zip up the file as some users cannot download an mp3/flac file properly if it is by itself.
That class/function doesn’t work on their server.
As I mentioned, it’s not the file I am chmoding and I am using a class from phpclasses.org
In the example that works, I use a test folder and chmod that test folder. I then run example.php, it points to a file and then a zip is downloaded through the browser.
When I try to simulate this through our website, where users download one of thousands of songs using different dynamic directories, I can’t get permission to do so.
As I mentioned, I don’t have the time, nor interest, in chmoding hundreds of folders which contain song id’s, which can make up the path of the file at any given point. So, does this mean I am stuck when it comes to making zip files? It’s incredibly frustrating to say the least.
Why do you need to chmod the files before adding them to the zip file? How are you zipping the files? (i.e. does this class use command line commands).
I use http://www.php.net/manual/en/class.ziparchive.php, and the only chmodding I need to do is to make sure the output path (where the zip file is stored) is writable. That’s after adding around 2500 files to it in any number of directories.