Empty Blank File Upload in ASP?

Nismo83

OSNN AZN Addict
Joined
13 Mar 2004
Messages
383
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

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.
Terrahertz wrote on Electronic Punk's profile.
Yo fellas!
Electronic Punk wrote on Sazar's profile.
Where are you buddy?
Perris Calderon wrote on Electronic Punk's profile.
Hey EP! All good with me, applying for Microsoft MVP right now, should have done this a while ago.

Notifications don't work, I only found your response by coming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier!

Forum statistics

Threads
62,000
Messages
673,425
Members
5,593
Latest member
moussa021