Kod:
<html>
<head>
<title>ASP File Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
</head>
<body>
<%
if Request.QueryString("islem")="yukle" Then
Server.ScriptTimeout=120
' *** Upload File
Set Upload = Server.CreateObject("Persits.Upload")
' *** Dosya boyutu için sınır koyuluyor.
Upload.SetMaxSize 10000000, True
Upload.Save
' *** Body bölümü
strBody = "Gönderilme Tarihi : " & now & VbCrLf & VBCrLf
For Each Item in Upload.Form
strBody = strBody & Item.Name& ":" & Item.Value & VBCrLf & VBCrLf
Next
' Path
pt="c:\upload"
ffileexist=0
For Each File in Upload.Files
ffileexist=1
fname=File.FileName
File.SaveAs pt & "\" & File.FileName
Next
strTo = "[email protected]"
strFrom ="[email protected]"
strSubject="Form doldurularak dosya gönderme"
Set myMail=CreateObject("CDO.Message")
myMail.Subject=strSubject
myMail.From=strFrom
myMail.To=strTo
myMail.TextBody=strBody
if ffileexist=1 then
newpt= pt & "\" & fname2
myMail.AddAttachment newpt
end if
myMail.Send
set myMail=nothing
else
%>
<form action="upload.asp?islem=yukle" name="form1" id="form1" method="post" ENCTYPE="multipart/form-data">
First name : <input name="FirstName" type="text" class="inputborder" id="First_Name" size="25"><br>
Surname : <input name="Surname" type="text" class="inputborder" id="Surname" size="25"><br>
Contact number :<input name="Contact" type="text" class="inputborder" id="Contact" size="25"><br>
File : <input type="file" class="inputborder" id="CV" name="CV" size="25">
<input name="Submit" type="button" onClick="javascript:formsubmit()" value="Submit" >
</form>
<% end if %>
</body>
</html>