i was wondering am i able to don't put any file in a file field and upload to the database and assuming it will not update it?
The language is ASP
This is the 3 field... If i don't select any file it will give me error.
This is the upload script.. i want those in red, purple and orange to update nothing into the database if i did not select any file in the form field.
How do i solve this issue?
The language is ASP
This is the 3 field... If i don't select any file it will give me error.
Code:
<INPUT TYPE=FILE NAME="THEFILE" value="">
<INPUT TYPE=FILE NAME="THEFILE1" value="">
<INPUT TYPE=FILE NAME="THEFILE2" value="">
Code:
<%@ LANGUAGE="VBScript" %>
[bad html removed]#include file="adovbs.inc" -->
<%
Server.ScriptTimeout = 50000
Set Upload = Server.CreateObject("Persits.Upload")
Upload.ProgressID = Request.QueryString("PID")
Count = Upload.Save
Set File = Upload.Files("THEFILE")
Set File1 = Upload.Files("THEFILE1")
Set File2 = Upload.Files("THEFILE2")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db.mdb")
strSQL = "SELECT * FROM services"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn, adOpenStatic, adOpenDynamic
objRS.AddNew
objRS("category") = Upload.Form("category")
objRS("catid") = Upload.Form("subcat")
objRS("title") = Upload.Form("Title")
objRS("teaser") = Upload.Form("Teaser")
objRS("description") = Upload.Form("Description")
objRS("data") = now()
[color=orange] objRS("Image_blob")= File.Binary
objRS("filename") = File.FileName
objRS("filesize") = File.Size
objRS("descr") = Upload.Form("DESCR")[/color]
[color=purple] objRS("Image_blob1")= File1.Binary
objRS("filename1") = File1.FileName
objRS("filesize1") = File1.Size
objRS("descr1") = Upload.Form("DESCR1")[/color]
[color=red] objRS("Image_blob2")= File2.Binary
objRS("filename2") = File2.FileName
objRS("filesize2") = File2.Size
objRS("descr2") = Upload.Form("DESCR2")[/color]
objRS.Update
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
response.write "File Added"
Response.Redirect("add.asp?success=true")
%>
Last edited by a moderator: