[PLUG] PHP question

Jon Jacob jon at manymoons.net
Sun May 19 01:27:12 UTC 2002


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






More information about the PLUG mailing list