Empty Blank File Upload in ASP?

Nismo83

OSNN AZN Addict
Joined
13 Mar 2004
Messages
384
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.
Code:
<INPUT TYPE=FILE NAME="THEFILE" value="">
<INPUT TYPE=FILE NAME="THEFILE1" value="">
<INPUT TYPE=FILE NAME="THEFILE2" value="">
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.
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")
%>
How do i solve this issue?
 
Last edited by a moderator:

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,623
Latest member
AndersonLo
Back