%@ Language=VBScript %>
<%Server.ScriptTimeout =12000%>
File Uploader
<%
'Response.end
'--- Declarations
dim oUploadedFile
dim catid, title, SQL, rsFind, subup, subcat
dim image1
catid=request.querystring("catid")
set getcat=objConn.execute("select * from cats where catid=" & catid)
if request.querystring("pic")>"" then
picid=request.querystring("pic")
set getphoto=objConn.execute("select * from photos where photoid=" & picid)
if not getphoto.eof then
photoname=getphoto("photoImage")
end if
end if
Dim oFileUp
'--- Instantiate the FileUp object
Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")
'--- Set the Path property to the location you wish to
'--- Save the first file
'--- Check to be sure there was a file selected in the form
'--- If so, continue processing
if oFileUp.Form("myFile1")>"" then
If Not oFileUp.Form("myFile1").IsEmpty Then
desc=oFileUp.Form("photoDesc")
oFileUp.Path = Server.MapPath("/" & getcat("catdir") & "/")
Set oUploadedFile = oFileUp.Form("myFile1")
oFileUp.Form("myFile1").Save
'--- The file is saved, display a confirmation message
Response.Write("File saved successfully on the server as: ")
'--- The ServerName() property is the full path of the file
'--- where it was saved on the server
Response.Write(oFileUp.Form("myFile1").ServerName & "
")
image1=oUploadedFile.ShortFileName
objConn.execute("insert into photos (photoImage, photoDesc, catid) values ('" & image1 & "','" & desc & "'," & catid & ")")
Else
Response.Write("Error: There was no file submitted for upload in the first field.
")
End If
end if
if oFileUp.Form("myFile2")>"" then
If Not oFileUp.Form("myFile2").IsEmpty Then
oFileUp.Path = Server.MapPath("/" & getcat("catdir") & "/")
Set oUploadedFile = oFileUp.Form("myFile2")
oFileUp.Form("myFile2").Save
'oFileUp.form("myFile2").SaveAs (photoname)
'--- The file is saved, display a confirmation message
Response.Write("File saved successfully on the server as: ")
'--- The ServerName() property is the full path of the file
'--- where it was saved on the server
Response.Write(oFileUp.Form("myFile2").ServerName & "
")
Else
Response.Write("Error: There was no file submitted for upload in the first field.
")
End If
end if
'--- Destroy objects
Set oFileUp = Nothing
set objConn=nothing
%>