Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

Check for SAFileup Submit Form

I have the below form and code but the file never gets uploaded because the "if len(upl.Form("subUpload")) <> 0 then" is never true. How do I check that the form as been submitted?

Set upl = Server.CreateObject("SoftArtisans.FileUp")
if len(upl.Form("subUpload")) <> 0 then

    BadMsg = ""

    if upl.IsEmpty Then
        BadMsg = "I had problems uploading your file"
    end if

    if BadMsg <= " " then
        upl.Path = "e:\Database\"
        upl.Form("File1").SaveInVirtual "/Database/Something_temp.mdb"
        realPath = "E:\Database\"

' ----------------------------------The Form
<form method="Post" ENCTYPE="multipart/form-data" action="UploadDB.asp">

<center><font size="+3">Upload Database</font></center>
<!--  <img src="images/headers_retailerslogoin.gif" width="560" height="40" /> -->
<% If BadMsg > " " then %>
    <center><font color="red"><b><%=BadMsg%></b></font></center<br />
<% end if %>
  <table border="0" cellpadding="5" cellspacing="0">
            <td class="txtGreen12Bold">Database to Upload:</td><td><Input size="50" type="file" name="File1" value=""></td>
      <td colspan="2"><img src="images/spacer.gif" width="100%" height="1" /></td>
        <td><Input type="submit" name="subUpload" value="Upload"></td>
  • 2
  • 2
1 Solution
I'd try if upl.Form("subUpload") then.

Their documentation is pretty poor. If you're interested, I suggest using File Upload Object from http://www.aspemporium.com/. It is much better one, and pure ASP. It has many samples within it, and a good documentation.

upl.Form("subUpload").TotalBytes>0 might work as well.
slamhoundAuthor Commented:
Your first suggestion turned up False every time while your second suggestion gave a "Object required: '[undefined]'" error message on the IF statement.
slamhoundAuthor Commented:
BUT upl.TotalBytes>0 worked!

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now