Welcome to PCCS-Linux.COM Hello, and welcome to the PCCS-Linux Home Page.
Your last visit was !!!
Your Browser is running on Other
 
PHP File Uploads
<?php
/*
** Create database: mysqladmin create fileuploads
** Create Table:
   CREATE TABLE fuploads ( id int(11) NOT NULL DEFAULT '0' auto_increment,
        filename varchar(100) NOT NULL,
        filesize varchar(50),
        description varchar(200),
        PRIMARY KEY (id),
        INDEX filename_idx (filename));

if($submit) {

if (is_uploaded_file($userfile)) {
   move_uploaded_file($userfile, "/home/www/htdocs/test/$userfile_name");
   print "File <FONT COLOR=red>" . $userfile_name . "</FONT>
was uploaded\n";

   $conn = mysql_connect("localhost","root","") or
die("ERROR: " . mysql_error()); 
   $qry = INSERT INTO fuploads VALUES
('','$userfile_name','$userfile_size','$description');
   $res = mysql_db_query("fileuploads",$qry) or
die("ERROR: " . mysql_error());
   print "<BR>" . $description ."\n";
 } else {
echo "Problem uploading: filename '$userfile_name'.";
 }


} else {

print "
<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"$PHP_SELF\"
METHOD=POST>
<INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"200000\">
<TABLE><TR>
<TH colspan=2 align=left>BRIEF Description</TH>
</TR>
<TR>
<TD colspan=2>
<INPUT TYPE=\"text\" NAME=\"description\" SIZE=50>
</TD>
</TR>
<TR>
<TD valign=middle>
Send this file: <INPUT NAME=\"userfile\" TYPE=\"file\">
</TD><TD>
<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Send File\">
</TD></TR>
</TABLE>
</FORM>
";
} 
  
?>



>> Comments/FeedBack


Page hits 54 last request on :11:11



This web site is prepared and maintained by Chauncey Thorn.
The information contained in this site was valid at the time of posting.
Chauncey Thorn, assumes no liability for damages incurred directly or indirectly as a result of errors, omissions or discrepancies.

Remember most of the content here are my notes...

All logos and trademarks in this site are property of their respective owner. All the rest © by PCCS-Linux.COM

PCCS-Linux.COM ::ource Advocate Articles catalogue
2000 2002