Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Download-scriptto DL Files Outside The Public_html Folder


I have a small Linux webserver, and want to find a (php) script
that lets my users download files located outside of the public_html
folder.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Require File In Folder Above Public_HTML.
I have a functions file in my /home folder. My web directory in /home/public_html/ .

I have a header file in /home/public_html/assets/includes/header.php .

The top line on the header.php is
<?php
require("../../databases.inc");
?>

The problem is that whenever I include my header in a folder (ie. /home/public_html/videos/index.php) it will not get the databases.inc file as its now looking in public_html instead of my /home folder. Is there any function in the $_SERVER functions or anything simliar to detect how many folders it has to navigate to inorder to find the functions file?

Drag Files From One Folder To Another Folder (copy) .. Possible?
Is it possible to write codings PHP or Javascript.. GUI representation
of File handling (ie. Drag files from one folder to another folder (copy)
like our windows).. pls give me some reference codings like this..

How To Detect Number Of Files And Files' Name In A Folder?
I have a server built in window + apche. I am trying to make a photo album, but I don't know what is the code for detecting the number of files in a server folder and the files' name~.

Anyone Know How To Create Automatic Download Using CURL And Creating A New Folder Every Day???
I want to save a zip file daily. The file is named the same thing
each day so I would like to create a folder and name it with today's
date and then save the zip file into that folder.

I'm using this code and can't seem to figure out how to create the new
folder and save the file there.
Any help is appreciated!

$todays_date = date("Ymd");

$fp = fopen (dirname(__FILE__) . '/file.zip', 'w+');//This is the file
where we save the information
$ch = curl_init('http://www.downloadhere.com/file.zip');//Here is the
file we are downloading
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);

So each day I should have something like 20070807file.zip.

How To Get The Files Names From The Folder Using PHP ..
How to get the files names from the folder using PHP .. is there any
specific command. If yes let me know that..

Paging Of Folder Files
i have a form which has a select button when user clicks it a popup opens which shows all images in abc folder
 
when user clicks on any image the window closes and the name of that image is entered in the text box in parent form, now its working fine uptill here but if user refresh the popup window then it disconnects from parent window so my code that fills the textbox in the parent form and closes the popup window does not work anymore im using it like parent.document.form.texthox.value=abc since popup window is refreshed it does not work as child any more and this code does not work.

Files And Folder Copying
I am trying to write a function to copy an existing folder and folder
structure but am already stuck.

What I want to do is the following:

Copy a default folder (default_folder) and all sub folders within it (down
to a possible 4 levels)
eg default folder
->subfolder1
->subfolder2
->sub subfolder1
->sub sub folder 2

I have a form where the user can enter the name of the new folder and an
option to confirm if they want to copy the files also located within the
default folder.
If the checkbox is not checked then copy just the folder structure only

Can this be acheived in one function or will it be based on 2 where a set of
empty folders are created and where the folders and files are copied over

What Is The Max PDF Files Allowed In A Folder?
Not sure where to put this question? I am building a book archives database with a front-end for some librarians. They want to upload book cover images onto the server (probably Win-NT). There are approximately 80000 records that will have the book cover images stored in a PDF document for each. Can I upload every PDF to the same folder? Is there some kind of limit for a folder?

Deleting Files From A Folder...
I have a folder with many pictures in it.
All have the name like: HHMMDDMMYYYY.jpg

H-hour
M-minute
D-day
M-month
Y-year

Now I want to delete all pictures which are older than now()-7days.
How Can I do it? In SQL would be no prob but with file deleting is problem.

Opening Files In The Same Folder..
I have a php file (1.php) that needs to open another php file (2.php) and parse it's output. 2.php gets it's data from an xml file and formats it in a pretty screen style. So what I need is something like: $fp = fopen ("2.php?file=file.xml","r"); but that wont work because there is no file called &#392;.php?file=file.xml' so how's it done?

Root Of Folder App Files
While I know putting a app into a folder was chiseled out of fine
scottish granite and carried upto the top of ben nevis by php newbies
many years ago - I dont think a folder is the best way to do it .

The fact a script is in a folder means certain instant problems if you
want to do certain things with .

Assuming a script doesnt have index.php and all the script files have a
filename prefix like phpgb_ then theres no chance of them clashing with
anything else and theres no real reason to continue using a folder for
the main script files .

While the script will have a app folder for various things - does it
make any sense not to use the root because of a single solitary file
called index.php .

phpgb_index.php is what I use and the method hasnt brought up a single
problem of any shape or description .

Gas lighting was once what everybody thought was the best way of doing
it until that darn new fangled electricity came along .

1 - 2 Millions Files In One Folder?
I have to store over a million files, 10 - 15 kb each, in one folder.
The files are created by my php script, sometimes the old files are
deleted and new ones are written.
So, basically on every connection my script reads/deletes/ writes files
from/to that folder.
Right now i have only around 300 000 files in that folder, and it feels
like its getting slower for that script to work. It does work at the
moment, but i am not sure what will happen when there is over a million
files there...
Are there any limits of files that can be stored in a folder?
Would it be better for me to use mysql? I am not sure how mysql will
cope with millions of writes/reads

How Does One Get A List Of All Files In A Folder?
need a list of all files (i have like 5k or so) in a folder, I need to add there names to a table

I am doing this so i can compare two tables

table 1. comments added to uploaded pics -finished pictures-
table 2. no comments added yet to uploaded pics (so they can be commented on GET IT?)  -unfinished pictures-

All the pictures are in a single folder for the time being i'm going to be making a form based on the pictures that are on table 2 so that they can have comments and titles and file name added to table 1 (to be done still) but i need to know all the file names for the folder in question, i guess i could do it via cmd line ls or something like that, i'll get back to you.

Pagination W/ Just Files In A Folder?
Example would be:

prev 12345 next

but doing this with just files and not DB records?

Viewing Files In A Web Folder
I'm trying to put my files in a web dirctory.  All kind of files, so that in the future when I need something I just go there and get them.  My goal is that when I type "www.domain.com/myVitualDirectory" I would get my list of files and folders and files and I would even be able to navigate into the folders, then I would right click and Save Target As and get my file.

Php Include Files From A Folder
I want to make a folder filled with blog posts by date.  Each file will be like 20071113.php and 20071031.php basically the date they were written 2007, 10 for october, and 31 for the day.  But each will be notated like that so that the number is always increasing. 

How would I make a php include function as to take the last ten highest numbers and add it to a page? (Basically the last ten posts by date) and  How would I include more than one post per date?

Indexing Text Files In A Folder
I'm newbie on Php. I cannot write codes but only modify.
I need a code doing this:
I'll put text files in a folder like file1.txt,file2.txt ...
I want to search this files, list most recent 10 and if files

call, script will put into the site design with <pre> tags.

Dropdown List Of Files In Folder
I am preparing a form that includes a drop-down list consisting of the names of files in a certain folder on the server.

I only need to trap the file name (jpg), not the path and I'm not trying to upload the files or anything - simply allow the user to select one of a number of different image files (they're actually location maps).

Recursive Copy Of Folder/files
I want to copy entire content(have both files and folders)from One folder to destination folder..

Opening All Text Files In A Folder
Im very new to php and need a bit of help. basically what I have is a folder with a number of text files inside. What i need to do is open every text file in that folder and then process the information inside each text file.

Im not really sure but I would assume I open the directory and place the name of each text file into an array and then loop through the array and process the contents of the text file.

#open directory

#foreach text file in the directory
#store file name into an array

#loop through array
#process code

Display A List Of Files In A Folder
How do you display a list of files in a folder and then delete one by clicking on it?

Displaying Files In A Folder Using A Calender
I have excel sheets generated daily and weekly in this format for filenames..for daily sheets the filename is Jan-10-2002 (mmm-dd-yyyy) and weekly Week-39-2002. I have a script that uploads to a constant folder all the excel sheets.

Is there a script that can display the daily scripts in form of a calender. I.E a user can choose to view or download the sheet by choosing the date? Also another for displaying weekly excel sheets in a weekly format.

How Can I Return The Number Of Files In A Folder?
How can i return the number of files in a folder?

Return All The .html Files In A Folder?
I'm trying to find all the include files in a folder is there a way to some how read a folder and then return an array with all the file names as the array keys or associative keys? I only want to return files that are .html or .php not all files

Show Html Files In A Folder
I am trying to create a script that will parse the folder it's containing php page is in for html files. Create a drop down list of links to the html files.
Anyone know how I might do this?

Deleting Files In A Folder Modified Before Certain Date
I use a cache system that requires creation of files in a folder .

Now , what i need to know is how can i delete files created say 3 days ago.

So that the cache remains fresh.

The directory contains around 20,000 files , about 10,000 are generated each day (if they dont exist)

So getting info about the each file after using opendir will cause the server to slow down.

Include Files Folder - CHMOD Settings?
Currently, I have various php files in my "public" folder on my webserver. I also have "include" php files in a designated folder w/in my "public" folder (i used include("file")

Example: path files

public folder => index.php, products.php, aboutus.php, etc
public folder/include folder => includefile1.php, includefile2.php, etc

what CHMOD settings should i set... so that users cannot directly open my "include" files? and where do i set them? on the "include" folder? on the individual "include" files?

Detecting PDF Files In A Folder And Sorting Them By Date
I am about to write an application that will display all pdf files in a
folder and display them by file name in order of date.

Is there an easy way of doing this? I was thinking about somehow adding
filename and date created in an array, sorting by date and then
printing onto an html page with a link to that file. How would I do
this though? Is this the simplest method or is there a better way of
doin this?

Uploading Mp3 Files To Folder On Server Via Php Form..
Im trying to design a webpage form in php that allows uploading of three mp3 files to a folder on my server. The webpage should convert the name of each mp3 file uploaded to 1.mp3 , 2.mp3 and 3.mp3 and whenever a new song is uploaded it should replace whatevers in the folder on the server, im totally stuck as where to begin.

I Can Upload Files Anywhere Except My Remote Root Folder
Im working on a project with PHP that allows users to upload pictures to my server and then reference them. After going through some uploading tutorials I have the uploading part working Except! I cant upload folders to my remote root folder. I need to allow the users to upload somewhere inside the root folder so they can reference the pictures in code after.

Just to clarify the uploading works perfectly if I put the uploads folder anywhere on my computer except the sites remote root folder (or anywhere inside the root folder)
I also beleive I am giving the folder all of the proper permissions because I am giving the uploads folder in my root directory (the one that doesnt work) the same permissions as the one outside the root (the one that works) Code:

Some Files Created Automatically In Mysql Database Folder
i have created one database in mysql. first i have created all tables
are of innodb type then i converted all tables to myisam type. i know
that for each myisam type table three files are created tablename.frm
tablename.myi and tablename.myd.

i have created database before one month. today i checked database and
i show somefiles exist in database folder named
(1)#sql-644_27.frm
(2)#sql-644_1.frm
(3)#sql-638_1.MYI
(4)#sql-638_1.MYD
(5)#sql-638_1.frm
(6)#sql-478_5.frm

can anyone tell me what is these files and why is these files?

Return The Amount Of Files In A Folder (including Subfolders)
Are there any functions available in php that will count the amount of files in a folder + its subfolders and return the answer? I'm sure there must be a simple answer for this.

Problem With Require() And Script Under Public_html
I'm trying to include PEAR's Net_IPv4 module in a web PHP script I'm
coding. Using PHP v4.4.0.

Other scripts on this web server (not personal user scripts, but main
site ones) call it with:

require_once("Net/IPv4.php");

and it works.

My script is under my public_html directory and if I use that same line
I get a "Fatal error: Call to undefined function: validateip() in
/home/james/public_html/test/srt/srt-0_3.php on line 258".

I thought that maybe PHP safe mode was on (theoretically it's not, but
since I don't own that IPv4.php file...), so I placed my own copy of
IPv4.php in my own public_html, then in the same dir as the script,
then under Net directories in each of the two previous ones, always
with the same error message.

This server's include path is set to:

include_path = ".:/usr/lib/php"

According to my interpretation of the documentation, if I use
"require_once("./IPv4.php");" and include IPv4.php in the script's same
directory it should work... what am I missing here?

I Can't See Any Dll Files In Php Download?
I downloaded the windows binary php4.0.4 from php.net and it says to move a certain dll file to your windows directory. I looked in the dll folder and it is empty. So, I tried downloading a php/apache package at a site just for windows users, and when I unzipped that package, I saw the dll files scrolling by in the unpacker window, but once again the dll folder was empty. Where are they?

Files Download Restriction
Is there any way where i can restrict a file to download only 10 times.

How Do I Hide Files From Download Without Php?
I want to hide files or better say restrict access to them for usual download. I want to send them just to allowed users with php? How do I do that?

I've tried to put variuos permisions on the directory, and then run this code:
<?
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=file.rar");
$ff = fopen("restricted/anyName.zip", 'r');
fpassthru($ff);
?>

If there are any restrictions, user downloads only 400b file, if there's no restrictions user gets normal filesize.

Zip Files, Then Force Download
Is there any examples or scripts that already will do this?

I need to zip an arbitrary amount of files, say maybe a $files array full of path names to the files filled dynamically from database based on an id number...

then i need it to automatically force a download of the zip file to the browser, then automatically delete the zip file when its finished...

Select Files To Download
i have made a page with several photos of a party. There is a
index in the page, and under each thumbnail there is a checkbox. With
them people can select the photos that he's going to download, but i
don't know how i can send the selected photos. I think "compress" all
the selected photos in a file and send it, but i couldn't do it. I
used zlib and bz2 libraries, but i dont know how i can put more than
one file, and even with an only file the compress file dont work. What
i make is open the file, read it and then compress the string get of
the read in the new compress file, but this file is empty or have a
code of the zlib.

Corrupted ZIP Files During Download Via PHP
I am posting this rather lengthy description here in hope of getting at
least some insight into a problem that is really hurting my business,
since I have come to the conclusion that my problem is at least partly
PHP-related.

Some time now I have been having transfer problems, i.e. my customers
downloads of large binary (ZIP) files are often corrupt.

A corrupted file now and then can of course never be avoided, but I get
several complaints from customers every day. Of any specific file,
approx. 1 out of 4 downloads (larger than 100kB or so) are affected.
I have spent months trying to find the source of the problems without
success, but I have been able to rule out many possible causes. Here are
some facts:

1) The actual files are OK on the server. Direct (unencrypted) links are
fine, so it's not a general problem.

2) About 50% of the customers download (the exact same files) from
another source. I don't even get 1 complaint every two months from those
customers, while I get 1-3 complaints _every day_ from those who
download from my server.

3) The customers have various SW/HW/OS, so it's very unlikely that it's
a user problem. Plus, the same customer often download from both places,
but only have problems with the files from my server.

4) I have shut down all scripts for a while, so that only a static
website remained, but it didn't help.

5) I have had this problem on three servers: The present RaQ550, the
previous RaQ4 and the RaQ4 I had before that. So it's highly unlikely
that it is server-related.

6) I can easily reproduce the problem myself. As I looked into this I
found a systematic error:

Analyzing corrupt vs. clean ZIP file downloads with a binary/hex editor
clearly shows that the error is systematic. Clean ZIP files have a lot
of &#3900;h' bytes in them. In ALL of the corrupt ZIP files ALL (well, most)
of these bytes have been exchanged for &#395;C30h', i.e. TWO bytes ( 00h ->
5C30h ) !

Since &#395;C30h' equals an escaped zero, i.e. "", my guess is that there
is a translation error somewhere.

So, what does PHP have to do with this? Well, my download links to
purchaseware are encrypted by the PHP "ewportal":

From the few facts I have been able to uncover it seems there is
sometimes a problem with corrupted ZIP files depending on the
setting/compilation of ZLIB. If anyone on this forum have experienced
similar things I would very much appreciate if they could share.
My servers PHP configuration is at:

Protect Download Files
I´m developping an application that needs to show some videos, but in
a protected envinroment. Any user must be authenticated to see the
videos. But for example, if anyone know the path of the videos, can
access directly to this site and download it without authentication.

If I write in the location bar the url of a video, I can download
without problem because the application cannot test if the user is
already authenticated or not. I´ve read something about RedirectMatch
and it works well but now the users cannot see the videos.

I try to write an example:

..- #I write this rule in the httpd.conf
RedirectMatch (.*).avi$
/myapplication/tools/downloadfile.php?filename=$1

With this rule I redirect all the requests for the video files include
the request of a window media player, but I don´t want to do this.
When I show the video directly on the web, I don´t need to redirect
but when is a direct request from url to download the file, I must
check if the user is authenticated.



Browser Tries To Download .php Files Instead Of Executing Them
I'm running Redhat 9 and just upgraded from PHP 4.2.x to 4.3.1 and no
when I try to execute a script on my local server here it opens a
window to try and download any .php files. I think Apache isn't
loading the module, but when I add in:

LoadModule php4_module modules/libphp4.so

it can't find the module and I can't find it on my system under
libexec or modules or anywhere else for that matter. What do I need
to do to httpd.conf (or php.ini) to make it execute these scripts?

User Download Files From Database
I make a code to Download file userfiles from database these are userfiles, admin upload files and user download it from the database,but there is little problem i can't fix it Code:

Download Files Quickly = Hang
This isn't exactly a PHP-related question, but I'm hoping that the
community of developers here will have experience dealing with it. We
want to allow users to view large files on our site, but we've realized
that if users in IE click from one file to another too quickly (before
the previous files have fully loaded), future files do not load until
they close and reopen their browsers. We believe this is because of
the two-concurrent-downloads limit -- apparently Firefox correctly
recognizes when a download has been abandoned on the user's end, while
IE does not, and this causes problems.

A Follow-up To My Download-all-files-as-a-zip-file Post
I made a script that successfully creates a .zip file of all the files
in a directory on my web server, but now what I haven't figured out
how to do is how to have it automatically deleted when the user
successfully downloads it, as otherwise my server would eventually get
clogged up with all these zip files.

Download Link For Exe Files Dont Work!
i'm developing a php app that shows folders and subfolders with their content so someone can download files from those browsers. the problem is: the download does not work for exe files!

http://www.scotland.ca/dmspro/_uplo...4Std_Manual.PDF
works and
http://www.scotland.ca/dmspro/_uplo...-%20netants.zip
works too! but
http://www.scotland.ca/dmspro/_uplo...ils/wrar320.exe
and
http://www.scotland.ca/dmspro/_uplo...ISO_v6_5_en.exe
do not work!!!

where could be the problem there??

Creating Download Manager For Multiple Files
Has anyone run across some sort of download manager to be able to download multiple files at a time via http with PHP? I run a mp3 site and I would like to be able to allow people to download whole folders at a time basically the same functionality as ftp but with http. It would be kind of like the smart download thing that netscape has but cross platform compatible. Any ideas?

Allowing Users To Download Files Using Headers
I am trying to create an area where a user can come to a page that
queries a database and displays links to files. Here is the code for
the link:

<td><a href="download.php?path=../ftp/$path&name=$name"
target="_blank">$name</a></font></b></td>

Quote:

Download Files From Remote Server To Local Webserver
I am trying to create a php page whereby people can download files from a remote server to their own server (to update their webdirectory with updated files/images etc). So for example one php page (e.g. update.php) should be able to download files from a remote server to a specific directory on their local webserver. Is this possible?

How To Allow Downloaded Files To Be Splitted When Using A Force-download Script ?
I suppose you all know force-download scripts. The problem is that
these scripts don't allow files to be splitted when downloading them
via a download manager.
I've found a solution to enable download resuming, but now, it remains
the splitting problem. Does anyone have any idea ?


Copyright © 2005-08 www.BigResource.com, All rights reserved