Re: move_uploaded_file on localhost
- From: groupie <justforgroups@xxxxxxxxx>
- Date: Tue, 8 Apr 2008 14:18:54 -0700 (PDT)
On Apr 8, 9:38 pm, Piotr <s...@xxxxxxxxxxxxxx> wrote:
Piotr wrote:
groupie wrote:
Hi,
The code below is working - it returns the 'Received' message, however
I cannot find the uploaded file in the destination folder, or anywhere
else (other than source directory). I'm running PHP 5.2.5 on my PC
running Apache 2.0. Thanks.
<?php
$uploadDir = "/uploads";
$temp = $uploadDir;
if(is_uploaded_file($_FILES['upfile']['tmp_name']))
{
}
else
{
echo "the file was not uploaded correctly, try again";
exit(0);
}
if(move_uploaded_file($_FILES["upfile"]["tmp_name"], $uploadDir ))
print "Received {$_FILES['upfile']['name']} - its size is
{$_FILES['upfile']['size']}";
else
{
echo "error moving file from ".$_FILES["upfile"]["tmp_name"]." to
$uploadDir";
exit(0);
}
?>
You should find your file in your root directory, it will be named
'uploads'.
To solve your problem, you should add a filename to the destination
part, like:
move_uploaded_file($_FILES["upfile"]["tmp_name"],
$uploadDir.$_FILES["upfile"]["name"] );
best regards
Piotr Nastaly
Ofc, i forgot to add directory separator
move_uploaded_file($_FILES["upfile"]["tmp_name"],
$uploadDir . DIRECTORY_SEPARATOR . $_FILES["upfile"]["name"] );- Hide quoted text -
- Show quoted text -
Thank-you! It's working fine now.
.
- References:
- move_uploaded_file on localhost
- From: groupie
- Re: move_uploaded_file on localhost
- From: Piotr
- Re: move_uploaded_file on localhost
- From: Piotr
- move_uploaded_file on localhost
- Prev by Date: Re: Captcha image Text Size
- Next by Date: Re: Captcha image Text Size
- Previous by thread: Re: move_uploaded_file on localhost
- Index(es):
Relevant Pages
|