View Single Post
  #5  
Old 10-20-2008, 08:16 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
Here we go:

Code:
<html>
<head>
<script type="text/javascript">
function init()
{
var attachbutton = document.getElementById("addextraattach");

if (attachbutton)
{
  attachbutton.onclick = addField;
}
}
function addField()
{
  allowedFiles = 10;
  if (!addField.count)
  {
     addField.count = 1;
  }
  else
  {
     addField.count++;
  }

if (addField.count < allowedFiles)
{
var boxDiv = document.createElement("div");

var box = document.createElement("input");
box.type = "file";
box.name = "attachments[]";

boxDiv.appendChild(box);

var attachments = document.getElementById("attachmentdiv");

if (attachments)
{
  attachments.appendChild(boxDiv);
}
}
else
{
    alert("You can only add "+allowedFiles+" files!");
}
}
</script>
</head>
<body onload="javascript:init();">

<form action="phMailer.php" method="post" enctype="multipart/form-data">
<div>Attachments</div>
<div>
<input type="file" name="attachments[]" />
<div id="attachmentdiv"></div><input type="button" value="Add Another Attachment" id="addextraattach" />
</div>
<span><input type="submit" value="Send" /></span>

</form>
</body>
</html>
__________________
Reply With Quote