Here is my upload file. Have two files like this just different file name to upload.
<?php
// set your folder
// give write rights on that folder
$today = date("Y-m-d\TH:i:s");
$uploaddir="download/";
$uploadfile =basename($_FILES['upload']['name']);
$filename = basename($_FILES['upload']['name']);
if ($_FILES['upload']['name']){
if (file_exists("$uploaddir/$uploadfile"))
{
rename("$uploaddir/$uploadfile","$uploaddir/$uploadfile + $today.bak");
}
if (move_uploaded_file($_FILES['upload']['tmp_name'], "$uploaddir/$uploadfile"))
{
//that mean upload is completed with success;
$msg = "Master 2000 thru 2005.xls has been uploaded, Thank you";
echo $msg;
}else{
//that mean upload faild;
$msg = "failed to upload, try again, if fails contact, webmaster@amour-rounds.com";
echo $msg;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My software - PHP Upload</title>
</head>
<body style="font-family:Arial; font-size:14px;">
<form name="addnews" enctype="multipart/form-data" method="post" action="phpupload.php">
<table border=2 cellspacing=1 cellpadding=4 align=center width=100% bgcolor="#000000">
<tr bgcolor="#FFFFFF">
<td width=121 valign="top" class="btext" height="28" align=right><div align="left"><b> Upload: Master 2000 thru 2005.xls</b></div></td>
<td valign="top" width=443><input type="hidden" name="MAX_FILE_SIZE2" value="6500000"/>
<input name="upload" type="file" size="60" style="font-family:Arial; font-size:14px;"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td valign="top" align="center" colspan="2">
<input type="submit" name="submit" value=" Submit " class="button">
</td>
</tr>
</table>
</form>
</body>
</html>
Edited by Orjan, 04 October 2010 - 02:36 PM.
removed double code tags


Sign In
Create Account

Back to top









