Re: problem with file upload script
| From: | AMC | Date: | Mon, 27 Sep 2004 20:23:27 +0000 |
| Subject: | Re: problem with file upload script | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198004@lists.php.net to get a copy of this message | ||
Hi,
I changed the script to upload to a different directory but it still doesn't
work, any ideas? I really appreciate the help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>
<?php
echo $_FILES['file']['tmp_name'];
echo $_FILES['file']['name'];
move_uploaded_file("{$_FILES['file']['tmp_name']}",
"../pdfs/{$_FILES['file']['name']}");
?>
<form method="post" action="test.php" ID="Form1"
enctype="multipart/form-data">
<b>Browse for file to upload:</b><input type="file" name="file"
ID="File1"/><br/>
<input type="submit" value="Upload!" ID="Submit1"
NAME="Submit1">
</form>
</body>
</html>
"Mike" <mihai@rivulus.ro> wrote in message
news:20040927194030.5400.qmail@pb1.pair.com...
> I don't know if I'm right, but ckeck this out:
> the echo $_FILES['file']['name'] variable holds the file name on the
> computer that uploads the file. and in one place you try to move the
> uploaded file from the temp folder back into the folder where it came
from.
> I suggest you create a new folder on the server you are using and move the
> file there.
> Hope it helps.
>
> "Amc" <aboehme@netgate.net> wrote in message
> news:20040927190315.23041.qmail@pb1.pair.com...
> > Hi,
> >
> > Here is a script I'm using to upload files. Can anyone see anything
wrong
> > with it? No file is uploaded when I click the upload button
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> >
> > <html>
> >
> > <head>
> >
> > <title></title>
> >
> > <meta name="GENERATOR" content="Microsoft Visual Studio.NET
> > 7.0">
> >
> > <meta name="vs_targetSchema"
> >
> > content="http://schemas.microsoft.com/intellisense/ie5">
> >
> > </head>
> >
> > <body>
> >
> >
> > <?php
> >
> > echo $_FILES['file']['tmp_name'];
> >
> > echo $_FILES['file']['name'];
> >
> > move_uploaded_file("{$_FILES['file']['tmp_name']}",
> > "{$_FILES['file']['name']}");
> >
> > ?>
> >
> >
> >
> > <form method="post" action="test.php" ID="Form1"
> > enctype="multipart/form-data">
> >
> > <b>Browse for file to upload:</b><input type="file"
> > name="file"
> > ID="File1"/><br/>
> >
> > <input type="submit" value="Upload!" ID="Submit1"
> > NAME="Submit1">
> >
> > </form>
> >
> > </body>
> >
> > </html>