For a project, im trying to take data from a user,ie name company phone etc, and let them pick artwork to upload. I want the file to be uploaded to the server and their field info pulled andput into a text file. I am using ABCupload as a addin. I just started using asp and can't figure out whats wrong with my code.Here is the asp code:
<% @Language="VBScript" %>
<html>
<body>
<%
Set theForm = Server.CreateObject("ABCUpload4.XForm"
Set theField = theForm("File"
(1)
If theField.FileExists Then
theField.Save "images/" & theField.FileName
Response.Write "File " & theField.FileName & " uploaded"
Else
Response.Write "No file uploaded"
End If
%>
<%
Set fs = CreateObject("Scripting.FileSystemObject"
Folderpath=server.mappath("\"
& "/uploads""
Wcounter=Folderpath & "/counter.txt"
Set fs = CreateObject("Scripting.FileSystemObject"
if fs.FolderExists(Folderpath) then
Set a = fs.OpenTextFile(Wcounter)
hits = Clng(a.ReadLine)
hits = hits + 1
a.close
else
Set a = fs.CreateFolder(Folderpath)
hits=1
end if
' Creates text file that keeps track of file number.
Set a = fs.CreateTextFile(Wcounter,True)
a.WriteLine(hits)
a.Close
Set fs=nothing
' creates text file with fields from form
Set fs = CreateObject("Scripting.FileSystemObject"
Set a = fs.CreateTextFile(Folderpath & "\" & hits & ".txt"
a.WriteLine("Date Submitted" & Now() & "."
a.WriteLine theForm("Name"
a.WriteLine theForm("Company"
a.WriteLine theForm("Phone"
a.WriteLine theForm("Email"
a.WriteLine theForm("message"
a.Close
Set a=nothing
Set fs=nothing
%>
<%
Response.Write "Thank you for uploading your file."<br>
'Gives user a proof number based on the value of hits.
Response.Write "Your proof number is" & hits & "."
'Redirected to Cox website after upload finishes.
%>
</body>
</html>
-----------------------
and the html:
<html>
<body>
<form method="post" action="mixedupload.asp" enctype="multipart/form-data">
<table border=0>
<tr>
<td>
<p><b>Name</b>:
</td>
<td>
<input type="text" name="Name" size=40>
</td>
</tr>
<tr>
<td>
<p><b>Company/Organization</b>:
</td>
<td>
<input type="text" name="Company" size=40>
</td>
</tr>
<tr>
<td>
<p><b>Phone Number</b>:
</td>
<Td>
<input type="text" name="Phone" size=40>
</td>
</tr>
<tr>
<Td>
<p><b>E-mail Address</b>:
</td>
<td>
<input type="text" name="Email" size=40>
</td>
</tr>
<tr>
<tr>
<Td>
<p><b>Description of Artwork</b>:
</td>
<td>
<textarea name="message" cols="30" rows="4"></textarea>
</td>
</tr>
<tr>
<Td>
<p><b>File</b>:
</td>
<Td>
<input type="file" name="File">
</td>
</tr>
</table>
<input type="submit" name="submit" value="Submit Artwork">
</form>
<body>
</html>
<% @Language="VBScript" %>
<html>
<body>
<%
Set theForm = Server.CreateObject("ABCUpload4.XForm"
Set theField = theForm("File"
If theField.FileExists Then
theField.Save "images/" & theField.FileName
Response.Write "File " & theField.FileName & " uploaded"
Else
Response.Write "No file uploaded"
End If
%>
<%
Set fs = CreateObject("Scripting.FileSystemObject"
Folderpath=server.mappath("\"
Wcounter=Folderpath & "/counter.txt"
Set fs = CreateObject("Scripting.FileSystemObject"
if fs.FolderExists(Folderpath) then
Set a = fs.OpenTextFile(Wcounter)
hits = Clng(a.ReadLine)
hits = hits + 1
a.close
else
Set a = fs.CreateFolder(Folderpath)
hits=1
end if
' Creates text file that keeps track of file number.
Set a = fs.CreateTextFile(Wcounter,True)
a.WriteLine(hits)
a.Close
Set fs=nothing
' creates text file with fields from form
Set fs = CreateObject("Scripting.FileSystemObject"
Set a = fs.CreateTextFile(Folderpath & "\" & hits & ".txt"
a.WriteLine("Date Submitted" & Now() & "."
a.WriteLine theForm("Name"
a.WriteLine theForm("Company"
a.WriteLine theForm("Phone"
a.WriteLine theForm("Email"
a.WriteLine theForm("message"
a.Close
Set a=nothing
Set fs=nothing
%>
<%
Response.Write "Thank you for uploading your file."<br>
'Gives user a proof number based on the value of hits.
Response.Write "Your proof number is" & hits & "."
'Redirected to Cox website after upload finishes.
%>
</body>
</html>
-----------------------
and the html:
<html>
<body>
<form method="post" action="mixedupload.asp" enctype="multipart/form-data">
<table border=0>
<tr>
<td>
<p><b>Name</b>:
</td>
<td>
<input type="text" name="Name" size=40>
</td>
</tr>
<tr>
<td>
<p><b>Company/Organization</b>:
</td>
<td>
<input type="text" name="Company" size=40>
</td>
</tr>
<tr>
<td>
<p><b>Phone Number</b>:
</td>
<Td>
<input type="text" name="Phone" size=40>
</td>
</tr>
<tr>
<Td>
<p><b>E-mail Address</b>:
</td>
<td>
<input type="text" name="Email" size=40>
</td>
</tr>
<tr>
<tr>
<Td>
<p><b>Description of Artwork</b>:
</td>
<td>
<textarea name="message" cols="30" rows="4"></textarea>
</td>
</tr>
<tr>
<Td>
<p><b>File</b>:
</td>
<Td>
<input type="file" name="File">
</td>
</tr>
</table>
<input type="submit" name="submit" value="Submit Artwork">
</form>
<body>
</html>