[PLUG] PHP question

Matt Alexander m at netpro.to
Sun May 19 04:21:09 UTC 2002


OK, I put a phpinfo() at the top of my script and it shows this:

_FILES["file"] Array
(
    [name] => somefile.txt
	 [type] => text/plain
	 [tmp_name] => /tmp/phpQl537A
	 [size] => 56
)

Soooooo...  It looks like PHP knows about the file I uploaded, but for
some reason my script doesn't see it.  When I print the $file and
$file_name variables, I don't get anything.  And /tmp/phpQ1537A doesn't
exist when I look in /tmp.
Thanks for your help.
~M


On 18 May 2002, Jon Jacob wrote:

> Try having the die message print out the name of the file and make sure
> that looks right and that it does exist.
>
> Still, I am sure you need the multipart/form section there.
>
> On Sat, 2002-05-18 at 19:40, Matt Alexander wrote:
> > Makes no difference.
> >
> >
> > On 18 May 2002, Jon Jacob wrote:
> >
> > > The form needs to have enctype="multipart/form" is my guess.
> > >
> > > <form method="post" action="upload.php" enctype="multipart/form">
> > >
> > > On Sat, 2002-05-18 at 17:28, Matt Alexander wrote:
> > > > I'm trying to upload a file using PHP.
> > > > Here's the main HTML file:
> > > >
> > > > <html>
> > > > <head><title></title></head>
> > > >
> > > > <form method="post" action="upload.php">
> > > >
> > > > <input type="file" name="file">
> > > > <p><input type="submit" name="submit" value="Upload">
> > > >
> > > > </form>
> > > >
> > > > </body>
> > > > </html>
> > > >
> > > >
> > > > And here's the PHP file:
> > > >
> > > > <?
> > > > if ($file != "") {
> > > > 	copy($file, "/tmp/$file_name") or die("Couldn't copy the file.");
> > > > }
> > > > else {
> > > > 	die("No message file specified.");
> > > > }
> > > > ?>
> > > >
> > > > <html>
> > > > <head><title></title></head>
> > > > <body>
> > > > You sent: <? echo "A $file_size byte file named $file_name
> > > > with a mime type of $file_type"; ?>.
> > > > </body>
> > > > </html>
> > > >
> > > >
> > > > Everytime I click the Upload button, I get "No message file specified."
> > > > My php.ini says it's allowing uploads.
> > > > Any ideas why this isn't working?
> > > > Thanks,
> > > > ~M
> > > >
> > > >
> > > > _______________________________________________
> > > > PLUG mailing list
> > > > PLUG at lists.pdxlinux.org
> > > > http://lists.pdxlinux.org/mailman/listinfo/plug
> > >
> > >
> > >
> > > _______________________________________________
> > > PLUG mailing list
> > > PLUG at lists.pdxlinux.org
> > > http://lists.pdxlinux.org/mailman/listinfo/plug
> > >
> >
> >
> > _______________________________________________
> > PLUG mailing list
> > PLUG at lists.pdxlinux.org
> > http://lists.pdxlinux.org/mailman/listinfo/plug
>
>
>
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>





More information about the PLUG mailing list