Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9
This is the forum to discuss the Wrox book PHP and MySQL: Create-Modify-Reuse by Timothy Boronczyk, Martin E. Psinas; ISBN: 9780470192429
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 4th, 2011, 03:54 PM
Authorized User
Points: 88, Level: 1
Points: 88, Level: 1 Points: 88, Level: 1 Points: 88, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Location: Rumford, Rhode Island
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default download not working in chapter 6

After more than a week of searching for code on the internet and carefully plugging it in to the applications in this chapter, I finally have everything working except the download function. I can't figure out what the problem is. Is there a setting in PHP.ini that I need to change in order to allow downloads to work?
Reply With Quote
  #2 (permalink)  
Old August 6th, 2011, 02:31 PM
Authorized User
Points: 374, Level: 6
Points: 374, Level: 6 Points: 374, Level: 6 Points: 374, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2009
Location: San Jose, Californina
Posts: 77
Thanks: 4
Thanked 6 Times in 6 Posts
Default

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.
Reply With Quote
  #3 (permalink)  
Old August 16th, 2011, 12:03 PM
Authorized User
Points: 88, Level: 1
Points: 88, Level: 1 Points: 88, Level: 1 Points: 88, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Location: Rumford, Rhode Island
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Wink Everything works now - finally!

I am finally able to get all the functionality of this chapter working the way that it is supposed to, no thanks to the code in the book or the code downloaded from the website. It took me weeks to debug the code from the book and the website (and in some cases, I had to throw it out entirely and find working code on the internet) in order to get this to work right. Anyway everything finally works. I am now able to view the remote site in the grid via AJAX, and I can upload, download, create new directories, rename files and directories, and delete them. I think that covers everything.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6 - Code Download Missing for this Chapter dbaechtel BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 0 August 11th, 2009 11:02 AM
Chapter 6 code download issues tdewey BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 1 April 13th, 2009 04:48 PM
Source download - chapter 5? dgy BOOK: Expert Access 2007 Programming ISBN 978-0-470-17402-9 1 January 8th, 2008 09:30 PM
When will the working download files ... kmccloud BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 3 July 13th, 2006 11:06 AM
Chapter 4 download file robtho BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 January 31st, 2005 06:18 PM



All times are GMT -4. The time now is 05:41 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.