php-windows Digest 24 Nov 2002 22:44:01 -0000 Issue 1455
Topics (messages 17095 through 17098):
Re: Subject: Help required... Simple File Upload
17095 by: Neil Smith
Unable to upload.. :(
17096 by: toby z
measuring space
17097 by: DaMouse
17098 by: Cam Dunstan
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
By default, your webserver doesnt have permissions to write to directories
other than /tmp or /temp.
File uploads as you discovered are placed in the temp directories first,
then you have to copy them to a storage directory accessible to your server
- though I recommend placing it outside document root so the uploaded files
can't be browsed directly.
You haven't specified the OS you are using, but I bet its win2k or NT - you
need to change the permissions on this directory to allow the webserver's
user or group write access to this directory and its subdirectories. (This
is common on linux but should work okay on w95/98/ME because they don't
have strong security settings for directory access)
Hope that helps
Neil Smith.
At 07:21 24/11/2002 +0000, you wrote:
Message-ID: <[EMAIL PROTECTED]>
Date: Sat, 23 Nov 2002 23:21:11 -0800 (PST)
From: Raheel Hussain <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="0-33574061-1038122471=:20420"
Subject: Help required... Simple File Upload
hi,
I got a problem in a simple file upload in a php file , i have two
pages and i m writing the code here as bellow
::page1.php::
Send this file: ::default2.php::
move_uploaded_file($_FILES['userfile']['tmp_name'],
"D:\\Raheel\\W3sites\\txtfiledemo\\uploads\\");
print($_FILES['userfile']['error']); :: on default2.php i have the
following error, which i can't figure out :: Warning: Unable to create
'D:\W3sites\txtfiledemo\uploads\': Permission denied in
D:\W3sites\txtfiledemo\default2.php on line 9 Warning: Unable to move
'c:\php\uploads\php76.tmp' to 'D:\W3sites\txtfiledemo\uploads\' in
D:\W3sites\txtfiledemo\default2.php on line 9 0
--------------------------------- Do you Yahoo!? Yahoo! Mail Plus -
Powerful. Affordable. Sign up now
--- End Message ---
--- Begin Message ---
Hi all
I am trying to upload a file. It works fine on my local Apache, but
gives me "Permission denied to create file" error on my online host..
Any clue???
$file = $_FILES['userfile']['tmp_name'];
if (is_uploaded_file($file))
print_r("Copying ".$file);
if (copy($file, "./files/". $_FILES['userfile']['name']))
echo("Success");
else
echo("Failure");
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--- End Message ---
--- Begin Message ---
I want to measure how much space is used by a
specific dir and echo it out
e.g.
/home/avalanche = 10mb
/home/damouse = 188kb
/home/pests == 20kb
![O]() Ensign Baker HCO
Officer USS Atlantis
|
--- End Message ---
--- Begin Message ---
DaMouse,
Here is a copy of a previous mail for a related problem, with filesizes and
a little arithmetic you should be able to adapt this to your needs
(Copy of mail to Darren)
Darren,
As others have said, PHP is not really the right tool for client side work
even if the client machine is also the server. Having said that, the
general style of task you are trying to achieve is frequently tackled by the
use of Recursive functions - functions that call themselves from "within"
themselves. This technique is not by any means limited to PHP, most
languages can do it. In pseudocode it might look a bit like this
function brain_explode ($directoryname)
do{
get a filename and size and type (from path $directoryname)
if (the file type is of type directory) {
brain_explode; // call "myself" again before I have finished THIS
iteration
} else {
echo the filename and size
}
} until there are no more files to list
end_of_function.
"until there are no more files to list" might in your instance be "until the
sought after pattern is found"
I dubbed this function brain_explode, plagiarised from Dash`s earlier mail,
because recursive functions, if let loose on really deep tree like
structures of any type (directories, websites, relational databases, linked
lists - whatever) can consume large amounts of memory. Every time they
recurse (call themselves) a totally new environment and set of variables is
created for another instance of the function to run in while the parent
function (and IT`S parents/grandparents) are still running (of course). So
a tree structure 5 levels deep will potentially trigger 5 instances of the
function running at the same time. If large arrays are involved (such as
SQL result sets) your brain could explode.
Hope this helps
----- Original Message -----
From: "DaMouse" <[EMAIL PROTECTED]>
To: "PHP - Win" <[EMAIL PROTECTED]>
Sent: Monday, November 25, 2002 1:58 AM
Subject: [PHP-WIN] measuring space
I want to measure how much space is used by a specific dir and echo it out
e.g.
/home/avalanche = 10mb
/home/damouse = 188kb
/home/pests == 20kb
Ensign Baker
HCO Officer
USS Atlantis
--- End Message ---