I am trying to upload file but its not working when I try and integrate this with other fields. Name, url (file), description etc if the data I am trying to send to the form.
Unfortunately if I pass more than the MAX_FILE_SIZE and the userfile variable I get an error.
I have included the code...
<?
if ( $dl_url )
{
@$res=copy($dl_url,"$dl_url_name");
if ( !$res )
print "Upload failed! \n";
else
{
$dl_time = microtime();
//Get username here!
$dl_user = "Snipher";
$result = @mysql_pconnect("*", "*", "*");
if (!$result)
return false;
if (!@mysql_select_db("xnet"))
return false;
$sql = "insert into download (name, url, type, description, user_name, count, time) values ($dl_name, $dl_url, $dl_type, dl_desc, $dl_user, 0, $dl_time)";
$result = mysql_query($sql);
if (!$result)
{
print "There was a database error when executing <PRE>$sql</PRE>";
print mysql_error();
exit;
}
}
}
else {
print "<table width=\"100%\">";
print "<form action=\"http://teamx.ath.cx/inc/add_dl.inc\" method\"post\" ENCTYPE=\"multipart/form-data\" >";
print "<tr><td class=\"center_heading\" colspan=\"2\">Add Download</td></tr>";
print "<tr><td width=\"200\">Type:</td><td><select name=\"dl_type\"><option value=\"Compressed\">Compressed File<option value=\"Image\">Image<option value=\"Executable\">Executable<option value=\"Audio\">Audio<option value=\"Video\">Video</selection></td></tr>";
print "<tr><td width=\"200\">Name:</td><td><input type=\"text\" size=\"55\" name=\"dl_name\"></td></tr>";
print "<INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"52428800\">";
print "<tr><td width=\"200\">Location:</td><td><input type=\"file\" size=\"41\" name=\"dl_url\"></td></tr>";
print "<tr><td width=\"200\">Description:</td><td><textarea cols=\"34\" rows=\"5\" name=\"dl_desc\"></textarea></td></tr>";
print "<tr><td></td><td><input type=\"submit\" name=\"Submit\"><input type=\"reset\" name=\"Clear\"></td></tr>";
print "</form>";
print "</table>";
}
?>