권장 : 루틴 : ASP를 사용하여 파일 주소가 유효한지 확인 다음은 인용 된 내용입니다. <% response.write (<head> <style> <!-Span {font-size : 9pt}-> </style> </head & g
| 다음은 인용 된 내용입니다. ASP를 사용하여 양식 컨텐츠를 데이터베이스에 삽입합니다. <% ' -loader.asp - ' - 버전 1.5.2 ' - 2002 년 12 월 5 일 마지막 업데이트 ' '파이살 칸 'www.stardeveloper.com '이진 업로드 처리를위한 클래스 클래스 로더 개인 dict private sub class_initialize set dict = server.createobject (scripting.dictionary) 종료 서브 개인 sub class_terminate iSobject (intdict)라면 intdict.removeall intdict = 아무것도 설정하지 않습니다 끝 If isobject (dict)라면 dict.removeall DICT = 아무것도 설정하지 않습니다 끝 If 종료 서브 공공 재산이 계산됩니다 count = dict.count 종료 속성 공개 하위 초기화 request.totalBytes> 0 인 경우 희미한 bindata bindata = request.binaryread (request.totalBytes) getData bindata 끝 If 종료 서브 공개 기능 getFiledata (이름) Dict.Exists (이름) 인 경우 getFiledata = dict (name) .item (value) 또 다른 getFiledata = 끝 If 엔드 기능 공개 기능 getValue (이름) 희미한 GV Dict.Exists (이름) 인 경우 gv = cstr (dict (name) .item (value)) gv = 왼쪽 (GV, Len (GV) -2) getValue = gv 또 다른 getValue = 끝 If 엔드 기능 공개 기능 savetofile (이름, 경로) Dict.Exists (이름) 인 경우 희미한 온도 temp = dict (name) .item (value) 희미한 fso set fso = server.createobject (scripting.filesystemobject) 희미한 파일 set file = fso.creatextfile (경로) tpoint = 1 to lenb (temp)의 경우 file.write chr (ASCB (midb (temp, tpoint, 1))) 다음 file.close savetofile = true 또 다른 savetofile = false 끝 If 엔드 기능 공개 기능 getFileName (이름) Dict.Exists (이름) 인 경우 희미한 온도, 온도 temp = dict (name) .item (filename) temppos = 1 instrev (temp, /) getfilename = mid (temp, temppos) 또 다른 getFilename = 끝 If 엔드 기능 공개 기능 getFilePath (이름) Dict.Exists (이름) 인 경우 희미한 온도, 온도 temp = dict (name) .item (filename) temppos = instrev (temp, /) getFilePath = MID (Temp, 1, Temppos) 또 다른 getFilePath = 끝 If 엔드 기능 공개 기능 getFilePathComplete (이름) Dict.Exists (이름) 인 경우 getFilePathComplete = Dict (이름) .item (filename) 또 다른 getFilePathComplete = 끝 If 엔드 기능 공개 기능 getFilesize (이름) Dict.Exists (이름) 인 경우 getFilesize = lenb (dict (name) .item (value)) 또 다른 getFilesize = 0 끝 If 엔드 기능 공개 기능 getFilesizetRanslated (이름) Dict.Exists (이름) 인 경우 temp = lenb (dict (name) .item (value)) 온도 <= 1024 인 경우 getfilesizetranslated = temp & bytes 또 다른 temp = formatnumber ((temp / 1024), 2) getfilesizetranslated = temp & kilobytes 끝 If 또 다른 getFilesizetRanslated = 끝 If 엔드 기능 공개 기능 getContentType (이름) Dict.Exists (이름) 인 경우 getContentType = dict (name) .item (contenttype) 또 다른 getContentType = 끝 If 엔드 기능 Private Sub getData (rawData) 딤분 분리기 분리기 = MIDB (RawData, 1, Instrb (1, RawData, chrb (13)) -1) 희미한 렌즈 배기기 Lenseparator = Lenb (분리기) 희미한 전류 currentpos = 1 Dim Instbyte Instbyte = 1 희미한 값, mvalue 희미한 온도 tempValue = Instbyte> 0 Instbyte = Instb (Currentpos, RawData, 분리기) mvalue = Instbyte- Currentpos MValue> 1이면 value = midb (rawdata, currentpos, mvalue) Dim Begpos, Endpos, MidValue, NValue Dim intdict intdict = server.createobject (scripting.dictionary) begpos = 1 instrb (1, 값, chrb (34)) endpos = instrb (begpos 1, value, chrb (34)) nvalue = endpos 희미한 이름 namen = midb (가치, begpos, endpos -begpos) Dim NameValue, IsValid isvalid = true instrb (1, 값, stringtobyte (content-type))> 1 인 경우 begpos = 1 instb (Endpos 1, value, chrb (34)) endpos = instrb (begpos 1, value, chrb (34)) endpos = 0이면 endpos = begpos 1 isvalid = false 끝 If midValue = midb (value, begpos, endpos -begpos) intdict.add filename, trim (bytetostring (midvalue)) begpos = 14 instrb (Endpos 1, 값, StringTobyte (Content-Type :)) endpos = instrb (begpos, value, chrb (13)) midValue = midb (value, begpos, endpos -begpos) intdict.add contenttype, trim (bytetoString (midvalue)) Begpos = Endpos 4 endpos = lenb (값) namevalue = midb (value, begpos, ((endpos -begpos) -1))) 또 다른 NameValue = trim (BytetoString (MIDB (value, nvalue 5)))))) 끝 If isvalid = true라면 intdict.add value, namevalue intdict.add 이름, namen dict.add bytetostring (namen), intdict 끝 If 끝 If Currentpos = Lenseparator Instbyte 향하게 하다 종료 서브 수업 종료 개인 기능 StringTobyte (toconv) 희미한 템포 i = 1 to len (toconv) tempchar = mid (toconv, i, 1) StringTobyte = StringTobyte & chrb (ASCB (Tempchar)) 다음 엔드 기능 개인 기능 바이터 스트링 (TOCONV) i = 1 to lenb (toconv)의 경우 BYTETOSTRING = BYTETOSTRING & ChR (ASCB (MIDB (Toconv, I, 1)))) 다음 엔드 기능 %> 1. 사용자 인터페이스 : <스크립트 언어 = javaScript> 기능 checkall (양식) {for (var i = 0; i <form.elements.length; i) {var e = form.elements [i]; if (e.name! = 'chkall') e.checked = form.chkall.checked; } } </스크립트> </head> <body> <form 메소드 = post action = del.asp name = form1> <테이블> <tr> <td> <입력 유형 = 확인란 값 = 111 이름 = 상인> 이메일 1 </td> </tr> <tr> <td> <입력 유형 = 확인란 값 = 111 이름 = 상인> 이메일 2 </td> </tr> <tr> <td> <입력 유형 = 확인란 값 = 111 이름 = 상인> 이메일 3 </td> </tr> <tr> <td> <입력 유형 = 확인란 값 = 111 이름 = 상인> 이메일 4 </td> </tr> <tr> <td> <입력 유형 = 확인란 값 = 111 이름 = 상인> 이메일 5 </td> </tr> <tr> <td> <입력 유형 = 확인란 값 = 111 이름 = 상인> 이메일 6 </td> </tr> <tr> <td bgcolor =#f1fbfc 높이 = 25 colspan = 2> <p align = left> <입력 유형 = 확인란 이름 = chkall value = on onclick = checkall (this.form)> <font color =#ff9900> 모든 표시된 메시지 선택 </font> </p> </td> <centre> </tr> </테이블> </form> 2. del.asp 파일을 삭제합니다 <% '이 라인은 데이터베이스에 연결하는 코드를 씁니다 DIM ID, Strid strid = request.form (tradeName)의 각 strid에 대해 id = cint (strid) Strid <>라면 delrs = server.createobject (adodb.recordset) conn.execute tbname에서 삭제 된 id = & cstr (id) strid = 끝 If 다음 conn.close Conn = 아무것도 설정하지 않습니다 Response.Ressiforect가 성공적으로 삭제되었습니다! %> |
공유 : ASP Advanced : ASP를 사용하여 파일 주소가 유효한지 확인 <%response.write (<head> <style> <!-스팬 {font-size : 9pt}-> </style> </head>)