T
Tim James
Newbie ASP Question.
I hope this is the right place to ask.
I have an ASP Upload element that I need help with.
This is the problem
I have 2 fields Image and FileName (FileName isnt the name of Image in this
case)
From page 1 I sudmit the 2 fields of info to the Upload Page.
The info arrives ok at the upload page.
I browse and select the file and hit submit...
The info for the Image arrives at destination but the FileName field does
not.
Heres the code I have...
<%
Dim MyFile
MyFile = Request("Name")
if UCase(Request.ServerVariables("HTTP_METHOD"))="POST" Then
Set fu = Server.CreateObject("AspUtil.FileUpload")
fu.directory = Server.MapPath(".")
rc = fu.Upload
If rc = 0 then
For n=0 to fu.count-1
set item = fu.item(n)
Response.Write "FileName: " & item.filename & "<BR>"
Response.Write "Bytes written: " & item.Size & "<BR>"
item.Save
Next
Else
Response.Write "File upload failed. RC: " & rc & "<BR>"
End If
response.redirect "http://dmsproxy/adm/products/add_image.asp?NewImage=" &
item.filename & "&FileName=" & MyFile
Else
%>
<form method=post ENCTYPE="multipart/form-data" action="upload_image.asp">
<font size="2"> Image</font><input type=file name=Image size="20"
value="<%=Request("Image")%>"><br>
Name<input type="text" name="Name" size="20"
value="<%=Request("Name")%>"><br>
<br>
<input type=submit></form>
<%
end If
%>
I hope this is the right place to ask.
I have an ASP Upload element that I need help with.
This is the problem
I have 2 fields Image and FileName (FileName isnt the name of Image in this
case)
From page 1 I sudmit the 2 fields of info to the Upload Page.
The info arrives ok at the upload page.
I browse and select the file and hit submit...
The info for the Image arrives at destination but the FileName field does
not.
Heres the code I have...
<%
Dim MyFile
MyFile = Request("Name")
if UCase(Request.ServerVariables("HTTP_METHOD"))="POST" Then
Set fu = Server.CreateObject("AspUtil.FileUpload")
fu.directory = Server.MapPath(".")
rc = fu.Upload
If rc = 0 then
For n=0 to fu.count-1
set item = fu.item(n)
Response.Write "FileName: " & item.filename & "<BR>"
Response.Write "Bytes written: " & item.Size & "<BR>"
item.Save
Next
Else
Response.Write "File upload failed. RC: " & rc & "<BR>"
End If
response.redirect "http://dmsproxy/adm/products/add_image.asp?NewImage=" &
item.filename & "&FileName=" & MyFile
Else
%>
<form method=post ENCTYPE="multipart/form-data" action="upload_image.asp">
<font size="2"> Image</font><input type=file name=Image size="20"
value="<%=Request("Image")%>"><br>
Name<input type="text" name="Name" size="20"
value="<%=Request("Name")%>"><br>
<br>
<input type=submit></form>
<%
end If
%>