Recomendado: Cómo usar ASP para mostrar imágenes GIF de la base de datos de acceso Escribir: 1: Lea el archivo de imagen GIF en la memoria (una variable strtemp). 2: Escribe en la base de datos. El siguiente es el contenido citado: dim bintmp () como byte dim conn como ADODB.Conn
| El siguiente es el contenido citado: <% Respuesta.Buffer = True Server.scripttimeout = 9999999 En el currículum de error siguiente %> <!-#include file = conn.asp-> <!-#include file = function.asp-> < <html xmlns = http: //www.w3.org/1999/xhtml> <Evista> <meta http-oquiv = content-type content = text/html; Charset = GB2312 /> <meta http-oquiv = content-language content = zh-cn /> <meta content = all name = robots /> <estilo type = text/css> <!- Cuerpo, entrada {Font-Size: 12px;} -> </style> <title> ASP FILE SUBIGA </title> </ablo> <Body ID = Body> <% checkuser () Extname = xls 'Permitir extensión SavePath = cargar 'savePath Si es correcto (guardarpath, 1) <>/ luego savePath = savePath &/ 'add (/) después del directorio CheckAndCreateFolder (SavePath) UploadAll_a = request.totalBytes 'Obtenga todo el contenido del cliente If (uploadAll_a> 0) entonces Configurar uploadstream_c = server.createObject (ADODB.Stream) Uploadstream_c.type = 1 Cargarstream_c.open Uploadstream_c.write request.binaryRead (uploadAll_a) Uploadstream_c.position = 0 FormdataAll_d = uploadstream_c.Read CRLF_E = CHRB (13) y CHRB (10) Formstart_f = instrb (FormDataAll_D, CRLF_E) Formend_g = instrb (Formstart_f 1, FormDataAll_D, CRLF_E) Establecer formstream_h = server.createObject (ADODB.Stream) Formstream_h.type = 1 Formstream_h.open UploadStream_c.Position = FormStart_F 1 Uploadstream_c.copyto formstream_h, formend_g-formstart_f-3 Formstream_h.Position = 0 Formstream_h.type = 2 Formstream_h.charset = GB2312 FormstreamText_i = formstream_h.readText Formstream_h.close FileName_j = Mid (FormStreamText_i, InstrREV (FormStreamText_i,) 1, Formend_G) If (checkFileExt (filename_j, extname)) luego SaveFile = server.mappath (SavePath & FileName_J) Si err entonces Response.WRITE ARCHIVO SOBRA: <span style = color: rojo;> el error de carga de archivo! </span> <a href = & request.servervariables (url) &> volver a cargar el archivo </a> <Br /> Err.Clear Demás SaveFile = checkFileExists (saveFile) SaveFileName = mid (saveFile, instrrev (saveFile,) 1) Session (archivo) = SaveFileName K = InstrB (FormDataAll_D, CRLF_E & CRLF_E) 4 l = InstrB (K 1, FormDataAll_D, LeftB (FormDataAll_D, FormStart_F-1))-K-2 Formstream_h.type = 1 Formstream_h.open Cargarstream_c.position = k-1 Uploadstream_c.copyto formstream_h, l Formstream_h.savetofile saveFile, 2 SaveFileName = mid (saveFile, instrrev (saveFile,) 1) Dim Conn1, Driver1, DBPATH1, RS1, SQL1 'Crear objeto de conexión Establecer Conn1 = Server.CreateObject (ADODB.Connection) Controlador1 = controlador = {Microsoft Excel Driver (*.xls)}; Dbpath1 = dbq = & server.mappath (cargar/& saveFileName) 'Llame al método abierto para abrir la base de datos Conn1.open Driver1 y DBPath1 SQL1 = SELECT * de [Hoja1 $] Establecer rs1 = Conn1.execute (SQL1) Si rs1.eof y rs1.bof entonces Respuesta. ¡Escribe los datos que necesitas no se encuentran! Demás Haz mientras no rs1.eof 'Inserte en la base de datos Opendatabase select * de ABC Si len (rs1 (0)) = 7 entonces ctime = izquierda (rs1 (0), 4) demás ctime = izquierda (rs1 (0), 5) final si Rs.addnew RS (Tiempo) = ctime rs. Cerrado Cerrado () Rs1.movenext Bucle Final si Rs1.lose Establecer rs1 = nada Conn1.clar Establecer Conn1 = nada 'Finalizar en la base de datos Response.Write File Carga: <span style = color: rojo;> & saveFileName & </span> ¡La carga de archivo fue exitosa! <a href = 'Choise.asp' '> Continuar cargando el archivo </a> <br /> Final si Demás Response.WRITE FILE SUPIGA: <span style = color: rojo;> El formato de archivo es incorrecto! </span> <a href = & request.servervariables (url) &> reuplicar el archivo </a> <r> Final si Demás %> <Script Language = JavaScript> <!- función ValidInput () { if (document.upform.upfile.value ==) { Alerta (¡Seleccione el archivo de carga!) document.upform.upfile.focus () devolver falso } Devolver verdadero } // -> </script> <Form Action = '< %= request.ServerVariables (url) %>' método = 'post' name = upform onSubMit = return ValidInput () Enctype = Multipart/Form-Data> Carga del archivo: <input type = 'file' name = 'UpFile' size = 40> <input type = 'enviar' value = upload> </form> <% Final si Establecer formstream_h = nada Uploadstream.close Configure uploadstream = nada %> </body> </html> |
Compartir: interpretar el código de inyección anti-SQL ASP El siguiente es el contenido referenciado: dim sql_injdata, sql_inj, sql_get, sql_data, sql_post sql_injdata = '| y | ejecut | insertar | seleccione | Eliminar | Actualizar |