Hi Boboneil,
I know you asked about downloads, but we before we can download
we have to make sure the files have been uploaded to the proper
location. The reason I am bringing this up is because there were
some issues with uploading. BASEDIR was getting concatenated to the
file path twice. There is a thread on this //which will explain a lot
of the issues with upload.
Chapter 6, Ajax File Manager, error in upload.php file
Anyway, let's work on downloads.
First, check lib/config.php and observe your setting for BASEDIR
Go to that location on the server and make sure you have some files
in there and that they have some size.
If there are no files in BASEDIR then that's the problem. Try adding
some files there to test if your download works.
Let's suppose you have a file there named mypicture.JPG
Now we are going to bypass a lot of code and just see if download.php
can get the file from the server to your host.
In your browser window type in
It should bring up a menu that ask you to save the file. If it does
that means download.php is working. You may want to ensure that it
actually moves the file down to your host.
There are some problems trying to download from subdirectories, so
for now just try it with files directly under the base directory.
When you want to start downloading from subdirectories the fix is
pretty easy, it's just one line in download.php.
You will change $_POST['dir'] to $_GET['dir'] on line 6.
See the following post for explanation and the solution.
Chapter 6, a solution for downloading files from subdirectories
Here is the flow of control for downloading.
In the web page, the file should be listed, it should
have a size (unless it's a directory), and you should
have selected it.
When you click the download/open button it will go to
filemanager.
js. The window.onload function will
handle the btn_open case and go to the openSelected function.
openSelected calls process.php and takes you to the case for open.
process.php returns the type of file, directory or file.
If it is a directory, it returns the new directory path, and openSelected
assigns window.directory to this new path. This allows you to traverse down
through directories.
If it is a file, it will go to download.php which is what will actually
download your file.
Here is my my experience with this flow of control.
I have not had any trouble with index.html or process.php.
filemanager.
js worked fine for downloads.
filemanager.
js did have an issue with uploading to
subdirectories, I posted an explanation of the problem
and a solution here. You will not need that fix for downloading.
Chapter 7, Online Photo Album, Ajax, cannot upload to subdirectories - here is the so
download.php has the problem I mentioned above
which is easily fixed, besides if you are not using subdirectories
download.php will work as is.
I hope this helps.
Let us know how it goes.