SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Location
    sri lanka
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cannot use Request.Form collection after calling BinaryRead.

    in my mail sending page i'm getting the following error

    Cannot use Request.Form collection after calling BinaryRead.

    can enyone explain y i'm getting that error

    here's my coding where i get the error

    Code:
    str2 = split(Request.form("C1"),",")
    i use the above code to get multiple checkbox values for getting the id's of the users to whom the mail should send

    here the mail sending works as a loop while the attachemnt also attached to the mail

    need ur help

  2. #2
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    What mail component are you using to send your mail?

  3. #3
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it sounds like you might be uploading a file before sending an email maybe? i've ran into the same problem with an upload component when trying to grab some other form fields. the particular component that we are using has a mechanism to get the data from the other fields to get around this issue. so, as thing said, we need a bit more info to help out...

  4. #4
    SitePoint Addict MadDog's Avatar
    Join Date
    Aug 2002
    Location
    Oregon, USA
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When uploading files you can not use Request.Form, so check the upload component you are using and see if they have an alternative for Request.Form or pass your information through the querystring.
    Drew Gauderman
    ASP/MSSQL/AJAX-Javascript/HTML/CSS Coder
    iPortalX The most secure FREE ASP portal!

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Location
    sri lanka
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi,

    i'm not using any component,this is my page
    Code:
    <%
    
    Dim ResultHTML
    
    
    Dim Form: Set Form = New ASPForm %><!--#INCLUDE FILE="_upload.asp"--><% 
    
    Server.ScriptTimeout = 1000
    'Do not upload data greater than 10MB. 
    Form.SizeLimit = &HA00000
    
    'Progress bar window will receive the same ID.
    Form.UploadID = Request.QueryString("UploadID")'{/b}
    
    Const fsCompletted  = 0
    
    If Form.State = fsCompletted Then 'Completted
      ResultHTML = ProcessForm
    ElseIf Form.State > 10 then
      Const fsSizeLimit = &HD
      Select case Form.State
    		case fsSizeLimit: ResultHTML = "<br><Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font><br>"
    		case else ResultHTML = "<br><Font Color=red>Some form error.</Font><br>"
      end Select
    End If 
    if request.QueryString("Action") = "Cancel" then
    	ResultHTML = "<br><b>Upload was cancelled</b>"
    end if
    
    Function TempFolder()
    	Dim FS
      Set FS = CreateObject("Scripting.FileSystemObject")
      'Get temporary folder
      TempFolder = FS.GetSpecialFolder(2) & "\emailtemp"
    End Function
    
    Sub DeleteFile(FileName)
    	Dim FS
      Set FS = CreateObject("Scripting.FileSystemObject")
    	FS.DeleteFile FileName
    End Sub
    
    
    
    
    '{b}get an unique upload ID for this upload script and progress bar.
    Dim UploadID, PostURL
    UploadID = Form.NewUploadID
    
    'Send this ID as a UploadID QueryString parameter to this script.
    PostURL = Request.ServerVariables("SCRIPT_NAME") & "?UploadID=" & UploadID'{/b}
    %>  
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
     <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>Emirates</title>
    <link href="images/css-site1.css" rel="stylesheet" type="text/css">
    
    <script language="JavaScript" type="text/JavaScript">
    
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    
    //function Mail()
    //{
    //document.frmmail.action="Mail.asp"
    //document.frmmail.submit();
    //}
    
    </script>
    </head>
    </HEAD>
    
    <%
    
    	set CN = Server.CreateObject("ADODB.Connection")
    	CN.ConnectionTimeout = Session("Gallery_ConnectionTimeout")
    	CN.CommandTimeout = Session("Gallery_CommandTimeout")
    	CN.CursorLocation = Session("Gallery_CursorLocation")
    	CN.Open Session("Gallery_ConnectionString"), Session("Gallery_RuntimeUserName"), Session("Gallery_RuntimePassword")
    	
    	set rs = server.CreateObject("Adodb.recordset")	
    	
    	'str2 = split(Request.from("C1"),",")	
    	'session("Nm")=session("Id")	
    	'cn.Execute("delete from temp where sid = '"& session("Nm")&"'")
    	
    	'for i = 0 to ubound(str2)
    			'session("data")=session("data")+str2(i)+","	
    			'Response.Write(session ("str2")) 
    			'next
    	'response.write(session("data"))
    	%>
    
    <body bgcolor="#fffdf0" leftmargin="0" topmargin="0" onLoad="MM_preloadImages('images/home1.gif','images/add1.gif','images/view1.gif','images/logout1.gif','images/help1.gif','images/mail.gif','images/print1.gif','images/mail1.gif')">
    <%'=ResultHTML%>
    <table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%">
      <tr>
        <td width="100%"><form method="post" ENCTYPE="multipart/form-data" OnSubmit="return ProgressBar();" Action="<%=PostURL%>">
    
            <div align="center">
              <center>
              <table border="0" width="752" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="100%" background="images/005.gif"><IMG height=1 src="images/blackline.gif" width=751 border=0></td>
                </tr>
                <tr>
                  <td width="100%" background="images/005.gif"><IMG height=91 src="images/logo.gif" width=104 border=0></td>
                </tr>
                <tr>
                  <td width="100%">
                    <table border="0" width="752" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="24"><IMG height=23 src="images/001.gif" width=24 border=0></td>
                        <td width="704" background="images/002.gif">&nbsp;</td>
                        <td width="24"><IMG height=23 src="images/003.gif" width=24 border=0></td>
                      </tr>
                      <tr>
                        <td width="752" colspan="3" background="images/wback1.gif">&nbsp;</td>
                      </tr>
                    </table>
                  </td>
                </tr>
                <tr>
                  <td width="100%">
                    <table border="0" width="752" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="126" valign="top" background="images/014.gif"><a href="index.htm"><img src="images/home.gif" name="Image1" width="126" height="20" border="0" id="Image1" onMouseOver="MM_swapImage('Image1','','images/home1.gif',1)" onMouseOut="MM_swapImgRestore()"></a><br>
                          <a href="index1.asp"><img src="images/add.gif" name="Image2" width="126" height="20" border="0" id="Image2" onMouseOver="MM_swapImage('Image2','','images/add1.gif',1)" onMouseOut="MM_swapImgRestore()"></a><br>
                          <a href="viewall.asp"><img src="images/view.gif" name="Image3" width="126" height="20" border="0" id="Image3" onMouseOver="MM_swapImage('Image3','','images/view1.gif',1)" onMouseOut="MM_swapImgRestore()"></a><br>
                          <a href="Print.asp" onMouseOver="MM_swapImage('Image4','','images/print1.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="images/print.gif" name="Image4" border="0" id="Image4" width="126" height="20"></a><br>
                          <a href="selectmail.asp" onMouseOver="MM_swapImage('Image5','','images/mail1.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="images/mail.gif" name="Image5" border="0" id="Image5" width="126" height="20"></a><br>
    					  <a href="deletelist.asp" onMouseOver="MM_swapImage('Image7','','images/deleteoptions1.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="images/deleteoptions.gif" name="Image7" width="125" height="20" border="0" id="Image7"></a><br>
    					  <a href="edit.asp" onMouseOver="MM_swapImage('Image7','','images/edit2.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="images/edit1.gif" name="Image7" border="0" id="Image7"></a><br>
                          <a href="SignOut.asp" onMouseOver="MM_swapImage('Image6','','images/logout1.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="images/logout.gif" name="Image6" border="0" id="Image6" width="126" height="20"></a>
                          <br>                    </td>
                        <td width="626" valign="top" background="images/015.gif">
                          <table border="0" width="100%" cellspacing="0" cellpadding="0">
                            <tr>
                              <td width="100%"><IMG style="LEFT: 1px; TOP: 0px" height=20 src="images/019.gif" width=626 border=0 ></td>
                            </tr>
                            <tr style="FONT-STYLE: normal; FONT-FAMILY: ">                        
                            
                            <% 
    							'if  Request.form("Subject")<> "" then							
    						%>	
    						<td width="100%" background="images/016.gif" height="40"><FONT size=2>Mail Sent to | <%' =Response.Write(session("data"))%> </FONT> </td>
                      
    						<%
    							'else
    						%>
    							<td width="100%" background="images/016.gif" height="40">&nbsp;&nbsp;&nbsp;</td>
    						<%
    							'end if							
    						%>
    						
    						
    								  
                            </tr>
                            <tr>
                              <td width="100%">
                                <table border="0" width="625" cellspacing="1" cellpadding="0" bgcolor="#d2d1bb">
                                  <tr>
                                    <td width="15">&nbsp;</td>
                                    <td width="115" bgcolor="#fffdf0"><font class="smalltxt">&nbsp;Subject</font></td>
                                    <td width="495" bgcolor="#fffdf0">&nbsp; <input name="Subject" size="23" class="design" value="<%=Form("Subject")%>"
                                 ></td>
                                  </tr>
                                  <tr>
                                    <td width="15">&nbsp;</td>
                                    <td width="115" bgcolor="#fffdf0" valign="top"><font class="smalltxt">&nbsp;Body</font></td>
                                    <td width="495" bgcolor="#fffdf0" valign="top">&nbsp; <TEXTAREA class=design name=Message rows=10 cols=55><%=Form("Message")%></TEXTAREA></td>
                                  </tr>
                                  <tr>
                                    <td width="15">&nbsp;</td>
                                    <td width="115" bgcolor="#fffdf0"><font class="smalltxt">&nbsp;</font><font class="smalltxt">Attach File</font></td>
                                    <td width="495" bgcolor="#fffdf0">&nbsp; <input type="file" name="File 1" size="23" class="design"></td>
                                  </tr>
                                </table>
                              </td>
                            </tr>
                            <tr>
                              <td width="100%" background="images/016.gif" height="30"><!--<IMG onclick=javascript:Mail() height=22 src="images/send.gif" width=55 border=0>--><input Name=SubmitButton Value="Send email &gt;&gt;" Type=submit><IMG height=22 src="images/018.gif" width=15 border=0><IMG height=22 src="images/018.gif" width=15 border=0></td>
                            </tr>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
                <tr>
                  <td width="100%">
                    <table border="0" width="752" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="752" colspan="3" background="images/017.gif">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="24"><IMG height=21 src="images/009.gif" width=24 border=0></td>
                        <td width="704" background="images/010.gif">&nbsp;</td>
                        <td width="24"><IMG height=21 src="images/011.gif" width=24 border=0></td>
                      </tr>
                    </table>
                  </td>
                </tr>
                <tr>
                  <td width="100%" background="images/005.gif">
                    <table border="0" width="100%" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="24" valign="top" background="images/013.gif"><IMG height=48 src="images/013.gif" width=24 border=0></td>
                        <td width="728" valign="top">
                          <p align="center"><font class="smalltxt1">Copyright  2005 Emirates.  All rights reserved.
                          <font color="#9e0c0f"><b> Terms of Service NOTICE:</b>&nbsp;</font><br>
     We collect personal information on this site.<br>
                          To learn more about how we use your information, see our <font color="#9e0c0f"><b> Privacy Policy</b><br>
                          &nbsp;</font></font></p></td>
                      </tr>
                    </table>
                  </td>
                </tr>
                <tr>
                  <td width="100%"><IMG height=1 src="images/blackline.gif" width=751 border=0></td>
                </tr>
              </table>
              </center>
            </div>
          </form></td>
      </tr>
    </table>
    
    <br>
    
    <SCRIPT>
    //Script to add an attachment file field 
    var nfiles = 1;
    function Expand(){
      nfiles++
      var adh = '<BR> Attachment '+nfiles+' : <input type="file" name="File '+nfiles+'">';
      files.insertAdjacentHTML('BeforeEnd',adh);
      return false;
    };
    
    //Open a window with progress bar indicator.
    function ProgressBar(){
      var ProgressURL
      ProgressURL = 'progress.asp?UploadID=<%=UploadID%>'
    
      var v = window.open(ProgressURL,'_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=350,height=200')
      
      return true;
    }
    </SCRIPT>
    
    
    </BODY></HTML>
    
    <%
    Function ProcessForm
    
      Dim objNewMail, File, FileName ,eFrom, eTo, Subject, Message
      
    'if subject <> "" then
    str3=split(request.form("C1"),",")
    
    
    for i =0 to ubound(str3) 
    'response.write(str3(i))
     Set objNewMail = CreateObject("CDONTS.NewMail")
      
      eFrom = "mahesha@webcaresys.net"
      eTo = str3(i)
      Subject = Form("Subject")
      Message = Form("Message")
      
      Const CdoMailFormatMime = 0
      objNewMail.MailFormat = CdoMailFormatMime
      'Save source files to temporary folder
      'Add these files to the new e-mail
    	HTML = HTML & "<br>Attachments:"
      For Each File In Form.Files.Items
    
        'If source file is specified.
        If Len(File.FileName) > 0 Then
    
    		  HTML = HTML & "<br>&nbsp;" & File.Name & ": <b>" & File.FileName & ", " & File.Length \ 1024 & "kB</b>"
          FileName = TempFolder & "\" & File.FileName 
        
          File.SaveAs FileName
          
          objNewMail.AttachFile FileName
        End If
      Next
      
      'Send the new email
      objNewMail.Send eFrom, eTo, Subject, Message
    
    
      'delete temporary files
      For Each File In Form.Files.Items
        If Len(File.FileName) > 0 Then
          FileName = TempFolder & "\" & File.FileName
          on error resume next
          DeleteFile FileName
        End If
      Next
      HTML = HTML & "</Font><br>"
      ProcessForm = HTML
      
      Next							
    '------------------------							
    	
    'end if
    '-----------------------
    End Function
    %>
    this is the place where i'm getting C1 check box values,it is inside another page

    Code:
    <tr>
                                    <td width="15">&nbsp;</td>
                                    <td width="50" bgcolor="#FFFDF0" align="center"><font class="smalltxt" size="2" face="Verdana"><input type="checkbox" name="C1"  id="C1" value= <% = rs.Fields("Email") %>></font></td>
                                    <td width="115" bgcolor="#FFFDF0" valign="top"><font class="smalltxt">&nbsp;<% =rs.Fields("Cusid")%></font></td>
                                    <td width="173" bgcolor="#FFFDF0" valign="top"><font class="smalltxt">&nbsp;<% =rs.Fields("Fullname")%></font></td>
                                    <td width="270" bgcolor="#FFFDF0" valign="top"><font class="smalltxt">&nbsp;<a href="mailto:<% =rs.Fields("Email")%>"><% =rs.Fields("Email")%></a></font></td>
                                  </tr>
    hope now u can get an idea

  6. #6
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what's in the inlude file "_upload.asp"? and i still think you are since you have this line: Form.SizeLimit = &HA00000. Straight ASP can't upload files that are very large without the help of a component. Plus there's this: Set Form = New ASPForm.

    rather than use your request.forms throughout the page, why don't you grab all those at the beginning, before you declare the form object and set them to variables? then you can use those variables later in the page in place of the request.forms.

  7. #7
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    digging further, you're correct, it's not a componenet, it's Pure ASP Upload: http://asp-upload.motobit.com/help/pureupload/pa38.htm.

    This page might help you in grabbing the rest of the form fields while using that: http://asp-upload.motobit.com/help/pureupload/cm345.htm

  8. #8
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Location
    sri lanka
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi all
    i solved my problem,thanks for the help.i did it different way using a temp table


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •