Avatar billede l_otto Nybegynder
16. januar 2004 - 12:01 Der er 14 kommentarer og
1 løsning

hjælp med denne fejl

Request object error 'ASP 0207 : 80004005'

Cannot use Request.Form

/idebank/info.asp, line 253

Cannot use Request.Form collection after calling BinaryRead.

linie 253 insætter jeg mine data
Avatar billede pfp Nybegynder
16. januar 2004 - 12:10 #1
Det er i forbindelse med noget upload eller image ik sandt?

Brug objektnavnet istedet for Request. F.eks. hvis du har et objekt der hedder Upload så skal det være Upload.Form("ditFelt")
Avatar billede l_otto Nybegynder
16. januar 2004 - 12:19 #2
jo... samme fejl

<%

if request.form("send") <> "" then
' ADODB connection objektet
Set Conn = Server.CreateObject("ADODB.Connection")
' Husk at angive den rigtige sti til din database
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")
' Åben databaseforbindelsen
Conn.Open DSN

strSQL = "Insert into Kontor (Fornavn, telefondato, telefonsub, telefonfelt, telefontid, telefonopret, note) values('" & Upload.Form("Fornavn") & "','" & Upload.Form("telefondato") & "','" & Upload.Form("telefonsub") & "','" & Upload.Form("telefonfelt") & "','" & Upload.Form("telefontid") & "','" & Upload.Form("telefonopret") & "','" & Upload.Form("note") & "')"
conn.execute(strSQL)
Alert = "Din ide er nu oprettet "
end if


%>

hvis jeg ændre det øverste request  bliver den sur..
Avatar billede pfp Nybegynder
16. januar 2004 - 12:23 #3
Jeg er nød til at se hvor du opretter dit upload objekt
Avatar billede l_otto Nybegynder
16. januar 2004 - 12:25 #4
<form method="post" action="<%=MM_editAction%>" name="form1" enctype="multipart/form-data" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,DOC,PDF,XLS',true,');return document.MM_returnValue"><a href="default.asp" target='_self'><%=Alert%></a>
<TABLE width="500" bgcolor="#FFCC66" class="Formindhold">
<TR>
    <TD class="BoxTop"><center> <TABLE>
    <TR>
        <TD valign="top" class="BoxTop"width="500"><FONT SIZE="1" COLOR="#FF0000"><b>Opret Ide <TABLE>
    <TR>
        <TD width="80"><FONT SIZE="1" COLOR="#000000">Oprettet af<td><select name="Fornavn" class="Formindhold">
                <option value="" selected><FONT SIZE="1" COLOR="#000000">Vælg person</option>
                <option value="Jesper">Jesper</option>
                    <option value="Peter ">Peter </option>
               
              </select></td></TD>    </TR>
       
        <TD ><FONT SIZE="1" COLOR="#000000">Dato<td><input type="text" name="telefondato" class="Formindhold" size="30" value="<%
Response.Write "Den " & FormatDateTime(Now, vbLongDate)
Response.Write " kl. " & FormatDateTime(Now, vbShortTime)
%>">
</td></TD>    </TR>
       
       
        <TD ><FONT SIZE="1" COLOR="#000000">Emne <td><input type="text" name="telefonsub" class="Formindhold" size="72"></td></TD></TR>   
<TD valign="top"><FONT SIZE="1" COLOR="#000000">Idegrundlag<td><textarea name="telefonfelt" rows="7" cols="100"  class="Formindhold"></textarea></td></TD></TR>
<TD valign="top"><FONT SIZE="1" COLOR="#000000">For<td><textarea name="telefontid" rows="7" cols="100"  class="Formindhold"></textarea></td></TD></TR>
<TD valign="top"><FONT SIZE="1" COLOR="#000000">Imod<td><textarea name="telefonopret" rows="7" cols="100"  class="Formindhold"></textarea></td></TD></TR>
<td nowrap align="right"><font color="#333333">Indsæt fil:
                                  </font></td>
                                <td>
                                  <input type="file" name="note" size="35" class="Fields" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,DOC,PDF,XLS',true,'',150,100,640,480,'PIC_WIDTH','PIC_HEIGHT')">
                                 
                               
                                </td>

    </TR>
   
   
   
    </TR>
    </TABLE>
   
    </TD>
    </TR>
    </TABLE>
    <input type="submit" value="Gem" name="submit" class="Buttons" >



</form>
Avatar billede l_otto Nybegynder
16. januar 2004 - 12:26 #5
nederst
<input type="file" name="note" size="35" class="Fields" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,DOC,PDF,XLS',true,'',150,100,640,480,'PIC_WIDTH','PIC_HEIGHT')">
Avatar billede pfp Nybegynder
16. januar 2004 - 12:27 #6
Du opretter ikke noget objekt i det du lige har postet
Avatar billede pfp Nybegynder
16. januar 2004 - 12:28 #7
Det nederst er Javascript, det har ikke noget med det her at gøre
Avatar billede pfp Nybegynder
16. januar 2004 - 12:28 #8
Hvad er det du gerne vil? Uploade et billede og gemme noget data i din database?
Avatar billede l_otto Nybegynder
16. januar 2004 - 12:30 #9
uploade excel ark og gemme i db og når jeg ser på personen så er der en link til det excel ark han har lagt op  her er hele min kode :

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/connDUpics.asp" -->
<!--#include file="ScriptLibrary/incPureUpload.asp" -->
<%
'*** Pure ASP File Upload -----------------------------------------------------
' Copyright (c) 2001-2002 George Petrov, www.UDzone.com
' Process the upload
' Version: 2.0.9
'------------------------------------------------------------------------------
'*** File Upload to: """doc""", Extensions: "GIF,JPG,JPEG,BMP,PNG,DOC,PDF,XLS", Form: form1, Redirect: "", "file", "", "uniq", "true"

Dim GP_redirectPage, RequestBin, UploadQueryString, GP_uploadAction, UploadRequest
PureUploadSetup

If (CStr(Request.QueryString("GP_upload")) <> "") Then
  on error resume next
  Dim reqPureUploadVersion, foundPureUploadVersion
  reqPureUploadVersion = 2.09
  foundPureUploadVersion = getPureUploadVersion()
  if err or reqPureUploadVersion > foundPureUploadVersion then
    Response.Write "<b>You don't have latester version of ScriptLibrary/incPureUpload.asp uploaded on the server.</b><br>"
    Response.Write "This library is required for the current page. It is fully backwards compatible so old pages will work as well.<br>"
    Response.End   
  end if
  on error goto 0
  GP_redirectPage = ""
  Server.ScriptTimeout = 600
 
  RequestBin = Request.BinaryRead(Request.TotalBytes)
  Set UploadRequest = CreateObject("Scripting.Dictionary") 
  BuildUploadRequest RequestBin, """../idebank/doc""", "file", "", "uniq"
 
  If (GP_redirectPage <> "" and not (CStr(UploadFormRequest("MM_insert")) <> "" or CStr(UploadFormRequest("MM_update")) <> "")) Then
    If (InStr(1, GP_redirectPage, "?", vbTextCompare) = 0 And UploadQueryString <> "") Then
      GP_redirectPage = GP_redirectPage & "?" & UploadQueryString
    End If
    Response.Redirect(GP_redirectPage) 
  end if 
else
  if UploadQueryString <> "" then
    UploadQueryString = UploadQueryString & "&GP_upload=true"
  else 
    UploadQueryString = "GP_upload=true"
  end if 
end if
' End Pure Upload
'------------------------------------------------------------------------------
%>
<%
' *** Edit Operations: (Modified for File Upload) declare variables

MM_editAction = CStr(Request.ServerVariables("URL")) 'MM_editAction = CStr(Request("URL"))
If (UploadQueryString <> "") Then
  MM_editAction = MM_editAction & "?" & UploadQueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>

<%
' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it

If (CStr(UploadFormRequest("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    FormVal = MM_fields(i+1)
    MM_typeArray = Split(MM_columns(i+1),",")
    Delim = MM_typeArray(0)
    If (Delim = "none") Then Delim = ""
    AltVal = MM_typeArray(1)
    If (AltVal = "none") Then AltVal = ""
    EmptyVal = MM_typeArray(2)
    If (EmptyVal = "none") Then EmptyVal = ""
    If (FormVal = "") Then
      FormVal = EmptyVal
    Else
      If (AltVal <> "") Then
        FormVal = AltVal
      ElseIf (Delim = "'") Then  ' escape quotes
        FormVal = "'" & Replace(FormVal,"'","''") & "'"
      Else
        FormVal = Delim + FormVal + Delim
      End If
    End If
    If (i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End if
    MM_tableValues = MM_tableValues & MM_columns(i)
    MM_dbValues = MM_dbValues & FormVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>

<link rel="stylesheet" href="css/default.css" type="text/css">
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,tester,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { tester=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (tester.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (tester!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (tester.indexOf('inRange') != -1) { p=tester.indexOf(':');
          min=tester.substring(8,p); max=tester.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (tester.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function checkFileUpload(form,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight) { //v2.09
  document.MM_returnValue = true;
  for (var i = 0; i<form.elements.length; i++) {
    field = form.elements[i];
    if (field.type.toUpperCase() != 'FILE') continue;
    checkOneFileUpload(field,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight);
} }

function checkOneFileUpload(field,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight) { //v2.09
  document.MM_returnValue = true;
  if (extensions != '') var re = new RegExp("\.(" + extensions.replace(/,/gi,"|").replace(/\s/gi,"") + ")$","i");
    if (field.value == '') {
      if (requireUpload) {alert('File is required!');document.MM_returnValue = false;field.focus();return;}
    } else {
      if(extensions != '' && !re.tester(field.value)) {
        alert('This file type is not allowed for uploading.\nOnly the following file extensions are allowed: ' + extensions + '.\nPlease select another file and try again.');
        document.MM_returnValue = false;field.focus();return;
      }
    document.PU_uploadForm = field.form;
    re = new RegExp(".(gif|jpg|png|bmp|jpeg|doc|pdf|xls)$","i");
    if(re.tester(field.value) && (sizeLimit != '' || minWidth != '' || minHeight != '' || maxWidth != '' || maxHeight != '' || saveWidth != '' || saveHeight != '')) {
      checkImageDimensions(field,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight);
    } }
}

function showImageDimensions(fieldImg) { //v2.09
  var isNS6 = (!document.all && document.getElementById ? true : false);
  var img = (fieldImg && !isNS6 ? fieldImg : this);
  if (img.width > 0 && img.height > 0) {
  if ((img.minWidth != '' && img.minWidth > img.width) || (img.minHeight != '' && img.minHeight > img.height)) {
    alert('Uploaded Image is too small!\nShould be at least ' + img.minWidth + ' x ' + img.minHeight); return;}
  if ((img.maxWidth != '' && img.width > img.maxWidth) || (img.maxHeight != '' && img.height > img.maxHeight)) {
    alert('Uploaded Image is too big!\nShould be max ' + img.maxWidth + ' x ' + img.maxHeight); return;}
  if (img.sizeLimit != '' && img.fileSize > img.sizeLimit) {
    alert('Uploaded Image File Size is too big!\nShould be max ' + (img.sizeLimit/1024) + ' KBytes'); return;}
  if (img.saveWidth != '') document.PU_uploadForm[img.saveWidth].value = img.width;
  if (img.saveHeight != '') document.PU_uploadForm[img.saveHeight].value = img.height;
  document.MM_returnValue = true;
} }

function checkImageDimensions(field,sizeL,minW,minH,maxW,maxH,saveW,saveH) { //v2.09
  if (!document.layers) {
    var isNS6 = (!document.all && document.getElementById ? true : false);
    document.MM_returnValue = false; var imgURL = 'file:///' + field.value.replace(/\\/gi,'/').replace(/:/gi,'|').replace(/"/gi,'').replace(/^\//,'');
    if (!field.gp_img || (field.gp_img && field.gp_img.src != imgURL) || isNS6) {field.gp_img = new Image();
          with (field) {gp_img.sizeLimit = sizeL*1024; gp_img.minWidth = minW; gp_img.minHeight = minH; gp_img.maxWidth = maxW; gp_img.maxHeight = maxH;
        gp_img.saveWidth = saveW; gp_img.saveHeight = saveH; gp_img.onload = showImageDimensions; gp_img.src = imgURL; }
    } else showImageDimensions(field.gp_img);}
}
//-->
</script><%
'Indsæt denne kode på alle de sider der skal beskyttes...
If Session("Valid") = "" Then
  Response.redirect "nej.asp"
End If
%><HTML>
<HEAD>
<TITLE>Ide Banken</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><link rel="stylesheet" type="text/css" href="ccs.txt">
<script language="javascript" type="text/javascript">
<!--
/****************************************************
    Author: Eric King
    Url: http://redrival.com/eak/index.shtml
    This script is free to use as long as this info is left in
    Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>
<BODY><center>
<table width="900" height="560" border="0" cellspacing="0" cellpadding="0" align="center">
<BR><TR>
    <TD valign="top" bgcolor="#EEF0F4">
    <TABLE>
    <TR>
        <TD height="80"></TD>
    </TR>
    </TABLE>
    <TABLE>
    <TR>
        <TD><TABLE>
    <TR>
        <TD class="BoxTop" width="900"><div style="font-family: verdana; font-size: 11px; font-weight: bold;"><FONT COLOR="#003366"><a href="default.asp">Forsiden</a> |<a href="info.asp">Opret Ide</a> |<a href="produkter.asp"> Ret i Ide</a> | <a href="kontakt.asp">Slet ide</a>  </TD>
    </TR>
    </TABLE></TD>
    </TR>
    </TABLE>
   
<center>
<TABLE>
<TR>
    <TD ><TABLE height="20">
    <TR >
        <TD></TD>
    </TR>
    </TABLE>
<%

if request.form("send") <> "" then
' ADODB connection objektet
Set Conn = Server.CreateObject("ADODB.Connection")
' Husk at angive den rigtige sti til din database
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")
' Åben databaseforbindelsen
Conn.Open DSN

strSQL = "Insert into Kontor (Fornavn, telefondato, telefonsub, telefonfelt, telefontid, telefonopret, note) values('" & Upload.Form("Fornavn") & "','" & Upload.Form("telefondato") & "','" & Upload.Form("telefonsub") & "','" & Upload.Form("telefonfelt") & "','" & Upload.Form("telefontid") & "','" & Upload.Form("telefonopret") & "','" & Upload.Form("note") & "')"
conn.execute(strSQL)
Alert = "Din ide er nu oprettet "
end if


%>

<center>
<form method="post" action="<%=MM_editAction%>" name="form1" enctype="multipart/form-data" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,DOC,PDF,XLS',true,');return document.MM_returnValue"><a href="default.asp" target='_self'><%=Alert%></a>
<TABLE width="500" bgcolor="#FFCC66" class="Formindhold">
<TR>
    <TD class="BoxTop"><center> <TABLE>
    <TR>
        <TD valign="top" class="BoxTop"width="500"><FONT SIZE="1" COLOR="#FF0000"><b>Opret Ide <TABLE>
    <TR>
        <TD width="80"><FONT SIZE="1" COLOR="#000000">Oprettet af<td><select name="Fornavn" class="Formindhold">
                <option value="" selected><FONT SIZE="1" COLOR="#000000">Vælg person</option>
                <option value="Jesper">Jesper</option>
                    <option value="Peter ">Peter </option>
               
              </select></td></TD>    </TR>
       
        <TD ><FONT SIZE="1" COLOR="#000000">Dato<td><input type="text" name="telefondato" class="Formindhold" size="30" value="<%
Response.Write "Den " & FormatDateTime(Now, vbLongDate)
Response.Write " kl. " & FormatDateTime(Now, vbShortTime)
%>">
</td></TD>    </TR>
       
       
        <TD ><FONT SIZE="1" COLOR="#000000">Emne <td><input type="text" name="telefonsub" class="Formindhold" size="72"></td></TD></TR>   
<TD valign="top"><FONT SIZE="1" COLOR="#000000">Idegrundlag<td><textarea name="telefonfelt" rows="7" cols="100"  class="Formindhold"></textarea></td></TD></TR>
<TD valign="top"><FONT SIZE="1" COLOR="#000000">For<td><textarea name="telefontid" rows="7" cols="100"  class="Formindhold"></textarea></td></TD></TR>
<TD valign="top"><FONT SIZE="1" COLOR="#000000">Imod<td><textarea name="telefonopret" rows="7" cols="100"  class="Formindhold"></textarea></td></TD></TR>
<td nowrap align="right"><font color="#333333">Indsæt fil:
                                  </font></td>
                                <td>
                                  <input type="file" name="note" size="35" class="Fields" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,DOC,PDF,XLS',true,'',150,100,640,480,'PIC_WIDTH','PIC_HEIGHT')">
                                 
                               
                                </td>

    </TR>
   
   
   
    </TR>
    </TABLE>
   
    </TD>
    </TR>
    </TABLE>
    <input type="submit" value="Gem" name="submit" class="Buttons" >



</form>
         

           


</td>
 
  </tr>
</table>


   
   
   
   
   
    </TD>
</TR>
</TABLE>

<!-- <TABLE >
    <TR >
        <TD class="BoxTop" width="900" align="center"><div style="font-family: verdana; font-size: 11px; font-weight: bold;"><FONT COLOR="#003366">Juhl & Korth - Hvedemarken 9 - 3550  Slangerup - tlf:70 252 257 - e-post:salg@juhlekorth.dk </TD>
    </TR>
    </TABLE> -->
      </td>
    </tr>
  </table>
Avatar billede pfp Nybegynder
16. januar 2004 - 12:36 #10
Prøv med dette. Alternativt kan du adskille din upload kode og din dbkode og lægge det i 2 sep. filer

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/connDUpics.asp" -->
<!--#include file="ScriptLibrary/incPureUpload.asp" -->
<%
'*** Pure ASP File Upload -----------------------------------------------------
' Copyright (c) 2001-2002 George Petrov, www.UDzone.com
' Process the upload
' Version: 2.0.9
'------------------------------------------------------------------------------
'*** File Upload to: """doc""", Extensions: "GIF,JPG,JPEG,BMP,PNG,DOC,PDF,XLS", Form: form1, Redirect: "", "file", "", "uniq", "true"

Dim GP_redirectPage, RequestBin, UploadQueryString, GP_uploadAction, UploadRequest
PureUploadSetup

If (CStr(Request.QueryString("GP_upload")) <> "") Then
  on error resume next
  Dim reqPureUploadVersion, foundPureUploadVersion
  reqPureUploadVersion = 2.09
  foundPureUploadVersion = getPureUploadVersion()
  if err or reqPureUploadVersion > foundPureUploadVersion then
    Response.Write "<b>You don't have latester version of ScriptLibrary/incPureUpload.asp uploaded on the server.</b><br>"
    Response.Write "This library is required for the current page. It is fully backwards compatible so old pages will work as well.<br>"
    Response.End   
  end if
  on error goto 0
  GP_redirectPage = ""
  Server.ScriptTimeout = 600
 
  RequestBin = Request.BinaryRead(Request.TotalBytes)
  Set UploadRequest = CreateObject("Scripting.Dictionary") 
  BuildUploadRequest RequestBin, """../idebank/doc""", "file", "", "uniq"
 
  If (GP_redirectPage <> "" and not (CStr(UploadFormRequest("MM_insert")) <> "" or CStr(UploadFormRequest("MM_update")) <> "")) Then
    If (InStr(1, GP_redirectPage, "?", vbTextCompare) = 0 And UploadQueryString <> "") Then
      GP_redirectPage = GP_redirectPage & "?" & UploadQueryString
    End If
    Response.Redirect(GP_redirectPage) 
  end if 
else
  if UploadQueryString <> "" then
    UploadQueryString = UploadQueryString & "&GP_upload=true"
  else 
    UploadQueryString = "GP_upload=true"
  end if 
end if
' End Pure Upload
'------------------------------------------------------------------------------
%>
<%
' *** Edit Operations: (Modified for File Upload) declare variables

MM_editAction = CStr(Request.ServerVariables("URL")) 'MM_editAction = CStr(Request("URL"))
If (UploadQueryString <> "") Then
  MM_editAction = MM_editAction & "?" & UploadQueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>

<%
' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it

If (CStr(UploadFormRequest("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    FormVal = MM_fields(i+1)
    MM_typeArray = Split(MM_columns(i+1),",")
    Delim = MM_typeArray(0)
    If (Delim = "none") Then Delim = ""
    AltVal = MM_typeArray(1)
    If (AltVal = "none") Then AltVal = ""
    EmptyVal = MM_typeArray(2)
    If (EmptyVal = "none") Then EmptyVal = ""
    If (FormVal = "") Then
      FormVal = EmptyVal
    Else
      If (AltVal <> "") Then
        FormVal = AltVal
      ElseIf (Delim = "'") Then  ' escape quotes
        FormVal = "'" & Replace(FormVal,"'","''") & "'"
      Else
        FormVal = Delim + FormVal + Delim
      End If
    End If
    If (i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End if
    MM_tableValues = MM_tableValues & MM_columns(i)
    MM_dbValues = MM_dbValues & FormVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>

<link rel="stylesheet" href="css/default.css" type="text/css">
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,tester,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { tester=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (tester.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (tester!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (tester.indexOf('inRange') != -1) { p=tester.indexOf(':');
          min=tester.substring(8,p); max=tester.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (tester.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function checkFileUpload(form,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight) { //v2.09
  document.MM_returnValue = true;
  for (var i = 0; i<form.elements.length; i++) {
    field = form.elements[i];
    if (field.type.toUpperCase() != 'FILE') continue;
    checkOneFileUpload(field,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight);
} }

function checkOneFileUpload(field,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight) { //v2.09
  document.MM_returnValue = true;
  if (extensions != '') var re = new RegExp("\.(" + extensions.replace(/,/gi,"|").replace(/\s/gi,"") + ")$","i");
    if (field.value == '') {
      if (requireUpload) {alert('File is required!');document.MM_returnValue = false;field.focus();return;}
    } else {
      if(extensions != '' && !re.tester(field.value)) {
        alert('This file type is not allowed for uploading.\nOnly the following file extensions are allowed: ' + extensions + '.\nPlease select another file and try again.');
        document.MM_returnValue = false;field.focus();return;
      }
    document.PU_uploadForm = field.form;
    re = new RegExp(".(gif|jpg|png|bmp|jpeg|doc|pdf|xls)$","i");
    if(re.tester(field.value) && (sizeLimit != '' || minWidth != '' || minHeight != '' || maxWidth != '' || maxHeight != '' || saveWidth != '' || saveHeight != '')) {
      checkImageDimensions(field,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight);
    } }
}

function showImageDimensions(fieldImg) { //v2.09
  var isNS6 = (!document.all && document.getElementById ? true : false);
  var img = (fieldImg && !isNS6 ? fieldImg : this);
  if (img.width > 0 && img.height > 0) {
  if ((img.minWidth != '' && img.minWidth > img.width) || (img.minHeight != '' && img.minHeight > img.height)) {
    alert('Uploaded Image is too small!\nShould be at least ' + img.minWidth + ' x ' + img.minHeight); return;}
  if ((img.maxWidth != '' && img.width > img.maxWidth) || (img.maxHeight != '' && img.height > img.maxHeight)) {
    alert('Uploaded Image is too big!\nShould be max ' + img.maxWidth + ' x ' + img.maxHeight); return;}
  if (img.sizeLimit != '' && img.fileSize > img.sizeLimit) {
    alert('Uploaded Image File Size is too big!\nShould be max ' + (img.sizeLimit/1024) + ' KBytes'); return;}
  if (img.saveWidth != '') document.PU_uploadForm[img.saveWidth].value = img.width;
  if (img.saveHeight != '') document.PU_uploadForm[img.saveHeight].value = img.height;
  document.MM_returnValue = true;
} }

function checkImageDimensions(field,sizeL,minW,minH,maxW,maxH,saveW,saveH) { //v2.09
  if (!document.layers) {
    var isNS6 = (!document.all && document.getElementById ? true : false);
    document.MM_returnValue = false; var imgURL = 'file:///' + field.value.replace(/\\/gi,'/').replace(/:/gi,'|').replace(/"/gi,'').replace(/^\//,'');
    if (!field.gp_img || (field.gp_img && field.gp_img.src != imgURL) || isNS6) {field.gp_img = new Image();
          with (field) {gp_img.sizeLimit = sizeL*1024; gp_img.minWidth = minW; gp_img.minHeight = minH; gp_img.maxWidth = maxW; gp_img.maxHeight = maxH;
        gp_img.saveWidth = saveW; gp_img.saveHeight = saveH; gp_img.onload = showImageDimensions; gp_img.src = imgURL; }
    } else showImageDimensions(field.gp_img);}
}
//-->
</script><%
'Indsæt denne kode på alle de sider der skal beskyttes...
If Session("Valid") = "" Then
  Response.redirect "nej.asp"
End If
%><HTML>
<HEAD>
<TITLE>Ide Banken</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><link rel="stylesheet" type="text/css" href="ccs.txt">
<script language="javascript" type="text/javascript">
<!--
/****************************************************
    Author: Eric King
    Url: http://redrival.com/eak/index.shtml
    This script is free to use as long as this info is left in
    Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>
<BODY><center>
<table width="900" height="560" border="0" cellspacing="0" cellpadding="0" align="center">
<BR><TR>
    <TD valign="top" bgcolor="#EEF0F4">
    <TABLE>
    <TR>
        <TD height="80"></TD>
    </TR>
    </TABLE>
    <TABLE>
    <TR>
        <TD><TABLE>
    <TR>
        <TD class="BoxTop" width="900"><div style="font-family: verdana; font-size: 11px; font-weight: bold;"><FONT COLOR="#003366"><a href="default.asp">Forsiden</a> |<a href="info.asp">Opret Ide</a> |<a href="produkter.asp"> Ret i Ide</a> | <a href="kontakt.asp">Slet ide</a>  </TD>
    </TR>
    </TABLE></TD>
    </TR>
    </TABLE>
   
<center>
<TABLE>
<TR>
    <TD ><TABLE height="20">
    <TR >
        <TD></TD>
    </TR>
    </TABLE>
<%

if request.form("send") <> "" then
' ADODB connection objektet
Set Conn = Server.CreateObject("ADODB.Connection")
' Husk at angive den rigtige sti til din database
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")
' Åben databaseforbindelsen
Conn.Open DSN

strSQL = "Insert into Kontor (Fornavn, telefondato, telefonsub, telefonfelt, telefontid, telefonopret, note) values('" & UploadRequest.Form("Fornavn") & "','" & UploadRequest.Form("telefondato") & "','" & UploadRequest.Form("telefonsub") & "','" & UploadRequest.Form("telefonfelt") & "','" & UploadRequest.Form("telefontid") & "','" & UploadRequest.Form("telefonopret") & "','" & UploadRequest.Form("note") & "')"
conn.execute(strSQL)
Alert = "Din ide er nu oprettet "
end if


%>

<center>
<form method="post" action="<%=MM_editAction%>" name="form1" enctype="multipart/form-data" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,DOC,PDF,XLS',true,');return document.MM_returnValue"><a href="default.asp" target='_self'><%=Alert%></a>
<TABLE width="500" bgcolor="#FFCC66" class="Formindhold">
<TR>
    <TD class="BoxTop"><center> <TABLE>
    <TR>
        <TD valign="top" class="BoxTop"width="500"><FONT SIZE="1" COLOR="#FF0000"><b>Opret Ide <TABLE>
    <TR>
        <TD width="80"><FONT SIZE="1" COLOR="#000000">Oprettet af<td><select name="Fornavn" class="Formindhold">
                <option value="" selected><FONT SIZE="1" COLOR="#000000">Vælg person</option>
                <option value="Jesper">Jesper</option>
                    <option value="Peter ">Peter </option>
               
              </select></td></TD>    </TR>
       
        <TD ><FONT SIZE="1" COLOR="#000000">Dato<td><input type="text" name="telefondato" class="Formindhold" size="30" value="<%
Response.Write "Den " & FormatDateTime(Now, vbLongDate)
Response.Write " kl. " & FormatDateTime(Now, vbShortTime)
%>">
</td></TD>    </TR>
       
       
        <TD ><FONT SIZE="1" COLOR="#000000">Emne <td><input type="text" name="telefonsub" class="Formindhold" size="72"></td></TD></TR>   
<TD valign="top"><FONT SIZE="1" COLOR="#000000">Idegrundlag<td><textarea name="telefonfelt" rows="7" cols="100"  class="Formindhold"></textarea></td></TD></TR>
<TD valign="top"><FONT SIZE="1" COLOR="#000000">For<td><textarea name="telefontid" rows="7" cols="100"  class="Formindhold"></textarea></td></TD></TR>
<TD valign="top"><FONT SIZE="1" COLOR="#000000">Imod<td><textarea name="telefonopret" rows="7" cols="100"  class="Formindhold"></textarea></td></TD></TR>
<td nowrap align="right"><font color="#333333">Indsæt fil:
                                  </font></td>
                                <td>
                                  <input type="file" name="note" size="35" class="Fields" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,DOC,PDF,XLS',true,'',150,100,640,480,'PIC_WIDTH','PIC_HEIGHT')">
                                 
                               
                                </td>

    </TR>
   
   
   
    </TR>
    </TABLE>
   
    </TD>
    </TR>
    </TABLE>
    <input type="submit" value="Gem" name="submit" class="Buttons" >



</form>
         

           


</td>
 
  </tr>
</table>


   
   
   
   
   
    </TD>
</TR>
</TABLE>

<!-- <TABLE >
    <TR >
        <TD class="BoxTop" width="900" align="center"><div style="font-family: verdana; font-size: 11px; font-weight: bold;"><FONT COLOR="#003366">Juhl & Korth - Hvedemarken 9 - 3550  Slangerup - tlf:70 252 257 - e-post:salg@juhlekorth.dk </TD>
    </TR>
    </TABLE> -->
      </td>
    </tr>
  </table>
Avatar billede l_otto Nybegynder
16. januar 2004 - 12:37 #11
jeg kan ikke selv finde det object ?
Avatar billede l_otto Nybegynder
16. januar 2004 - 12:42 #12
øv samme fejl.... :-(
Avatar billede l_otto Nybegynder
19. januar 2004 - 09:20 #13
hjælp...
Avatar billede l_otto Nybegynder
19. januar 2004 - 12:28 #14
er du der ?
Avatar billede l_otto Nybegynder
20. januar 2004 - 12:08 #15
jeg har selv løst det .-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester