%
Dim ResultHTML
'Some value greater than default of 60s (According to upload size.)
'The maximum speed is about 100kB/s for IIS4, P200 and local upload, 4kB/s for modem users.
Server.ScriptTimeout = 300
Dim DestinationPath
DestinationPath = Server.MapPath("abstracts")'Folder to store uploaded files
LogFolder = Server.MapPath("abstracts") 'Folder to store log file with info about upload request.
'Set upload limit to 2MB
UploadSizeLimit = 2000000
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then 'Request method must be "POST" for get the fields
' BeginTimer 'Starts timer.
'************************************************* Main Upload - start
Dim Upload
on error resume next
'Gets uploaded fields
Set Upload = GetUpload()
Set Paper=Server.CreateObject("ADODB.Connection")
Paper.open "deneme"
If Upload("File1").Value.String="" then
Response.Write "
"" Please choose a File ! """
End if
If Upload("PAPERTITLE").Value.String="" then
Response.Write """ Please enter the Paper Title ! """
End if
If Upload("AUTHORS").Value.String="" then
Response.Write """ Please enter the names of the Authors ! """
End if
If Upload("FIRSTNAME").Value.String="" then
Response.Write """ Please enter your First Name ! """
End if
If Upload("SURNAME").Value.String="" then
Response.Write """ Please enter your Surname ! """
End if
If Upload("AFFI").Value.String="" then
Response.Write """ Please enter your Affiliation ! """
End if
If Upload("COUNTRY").Value.String="" then
Response.Write """ Please enter your Country ! """
End if
If Upload("NETWORK").Value.String="" then
Response.Write """ Please enter your E-Mail ! """
End if
If not (Upload("File1").FileName="" or Upload("PAPERTITLE").Value.String="" or Upload("AUTHORS").Value.String="" or Upload("FIRSTNAME").Value.String="" or UCASE(Upload("SURNAME").Value.String)="" or Upload("AFFI").Value.String="" or UCASE(Upload("COUNTRY").Value.String)="" or Upload("NETWORK").Value.String="") then
Set Paperrecords=Server.CreateObject("ADODB.RecordSet")
Paperrecords.Open "VIM01", Paper,adOpenStatic,adLockOptimistic
Paperrecords.Addnew
Paperrecords("PAPERTITLE")=Upload("PAPERTITLE").Value.String
Paperrecords("AUTHORS")=Upload("AUTHORS").Value.String
Paperrecords("FIRSTNAME")=Upload("FIRSTNAME").Value.String
Paperrecords("SURNAME")=UCASE(Upload("SURNAME").Value.String)
Paperrecords("AFFI")=Upload("AFFI").Value.String
Paperrecords("COUNTRY")=UCASE(Upload("COUNTRY").Value.String)
Paperrecords("NETWORK")=Upload("NETWORK").Value.String
Paperrecords("FILENAME")=Upload("File1").FileName
Paperrecords("DATE")=Date()
If not Upload("COMMENTS").Value.String="" then
Paperrecords("COMMENTS")=Upload("COMMENTS").Value.String
End if
Paperrecords.Update
Paperrecords.Close
Set Paperrecords=nothing
Paper.close
Set Paper=nothing
Dim oMailMessage
Set oMailMessage = Server.CreateObject("CDONTS.NewMail")
oMailMessage.from = "ichmt@metu.edu.tr"
oMailMessage.to = Upload("NETWORK").Value.String
oMailMessage.bcc = "ichmt@metu.edu.tr"
oMailMessage.subject = "Abstract upload for VIM-2001 Symposium"
oMailMessage.BodyFormat = 0
oMailMessage.body = "Dear " & Upload("FIRSTNAME").Value.String&"," & vbCrLf & vbCrLf & "Below is the information you successfuly uploaded to the Web server of ICHMT regarding VIM-01 symposium. Thank you." & vbCrLf & vbCrLf & " Paper Information:" & vbCrLf & vbCrLf & "Paper Title: " & Upload("PAPERTITLE").Value.String & vbCrLf & "Authors: " & Upload("AUTHORS").Value.String & vbCrLf & "File : " & Upload("File1").FileName & vbCrLf & vbCrLf & " Corresponding Author Information: " & vbCrLf & vbCrLf & "First Name: " & Upload("FIRSTNAME").Value.String & vbCrLf & "Surname: " & UCASE(Upload("SURNAME").Value.String) & vbCrLf & "Affiliation : " & Upload("AFFI").Value.String & vbCrLf & "Country: " & UCASE(Upload("COUNTRY").Value.String) & vbCrLf & "E-Mail: " & Upload("NETWORK").Value.String & vbCrLf & "Date: " & Date()
oMailMessage.Send()
' Release the NewMail object
Set oMailMessage = Nothing
' Release the object
'There are all of form fields in the Fields object. Example :
'Upload("File1").ContentType - content type of File1 field
'Upload("File1").Value.String - File1 field converted to a string
'Upload("File1").Value.ByteArray - File1 field as safearray to store in binary RS field or file
'Upload("Comments").Value.String - value of Comments field
'See HTML documentation of FormFields class (ScriptUtilities, http://www.pstruh.cz)
ResultHTML = ""
Response.Write "
"" Upload was Successful! Thank you. You will receive a confirmation email.""
"
'Write statistics about upload. Optional.
'Saves the fields to the disk, writes result to the client and writes log.
'See utils.inc. You can change the function to save the files to another location.
ResultHTML = ResultHTML & "
" & SaveUpload(Upload, DestinationPath, LogFolder)
' Write the error
'The error can be one of :
'Upload size exceeds limit
'Zero length request
'No file sent
'Bad request method - must be post
ResultHTML = ResultHTML
End If
On Error GoTo 0
Upload = Empty 'Clear the variable
'************************************************* Main Upload - end
' EndTimer 'Writes info about consumed time.
End If 'Request method must be "POST"
%>
<%'upload.inc, contains GetUpload function, Required for upload - only the one file%>
<%'utils.inc, contains SaveUpload function%>
<%'format.inc, contains head and Foot function, optional.%>
<%
response.write Head("Sample multiple binary files upload via ASP", "Demonstrates using of the ByteArray class for working with binary data from Request.BinaryRead.")
response.write upDescription
response.write CheckRequirements
%>
Please NOTE that all areas (except Comments) must be filled in and that you can upload files of maximum 2 MB size.
<%=ResultHTML%>
<%=Foot%>