FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Smart File Downloader - simple script on xampp
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Smart File Downloader - simple script on xampp [message #175994 is a reply to message #175982] Mon, 14 November 2011 13:47 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Mon, 14 Nov 2011 01:48:13 -0800, ddk wrote:

> On Nov 12, 7:58 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:

>> But you should keep the files outside of your website directory -
>> otherwise people can download them directly if they figure out the
>> path.

> got this, i use xammp in other PC without IP public and successful with
> BASE_DIR 'C:/xampp/htdocs/test123/files' and download files in "files"
> folder under folder "test123"

No, you didn't understand what Jerry was saying.

c:/xampp/htdocs and everything below it is your website.

Jerry is suggesting that you store your downloads somewhere like:

c:/xampp/private/downloads

And then set BASE_DIR as "c:/xampp/private/downloads"

Your method: people can download files using:

http://your-host-name-or-ip/test123/files/filename.ext

Jerry's method, they can't, they *must* use your downloads.php

> but when i set the same configuration with my xammp with IP public ,
> it's still get error page below :
>
> Warning: opendir(C:\xampp\htdocs\test123\files) [function.opendir]:
> failed to open dir: No such file or directory in E:\xampp\htdocs
> \test123\download.php on line 98

For some reason, although you're defining drive C:, it seems to be
looking on drive E:. This suggests something is misconfigured, but as my
experience is more with linux than windows, I can't offer any help.

I suspect you may be suffering path confusion due to running a server on
one machine that is accessing files on another machine across some
microsoft networking implementation.

If you open a command prompt /on the machine that the web server is
running on/, what happens if you try to enter the following commands in
exactly the following sequence:

e:
cd \
cd xampp
cd htdocs
cd test123
dir
cd files
dir

If you get an error after entering any command(s), which command(s), and
what was the error?

> Warning: readdir() expects parameter 1 to be resource, boolean given in
> E:\xampp\htdocs\test123\download.php on line 100 File does not exist.
> Make sure you specified correct file name.

This is telling you that the argument to readdir() is wrong. Look at line
100 of download.php, and trace back to where the relevant argument is
being assigned (if a variable) or defined (if a constant).

> it's there any security that i should be allow to access the directory.

Your web server process will need read access to the directory and the
files in it. If it's trying to handle uploads too, it will also need
write access to the directory.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: Embedding HTML Within a PHP Statement
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Dec 01 01:33:49 GMT 2024

Total time taken to generate the page: 0.04461 seconds