
16/02/2002, 18:40
|
| | Fecha de Ingreso: enero-2002
Mensajes: 141
Antigüedad: 23 años, 4 meses Puntos: 0 | |
Re: Tema dificil, para expertos. ANTONIO, todo lo que te dice BAKANZIP es correcto, pero tambien se puede hacer sin componentes te mando un ejemplo que sube un archivo binario a una base de datos desde un formulario:
f Request.QueryString("action")="uplo ad" then
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
ByteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
BuildUploadRequest RequestBin
Dim aux, aux1, FILEFLAG
Dim ImageName, ContentType, FilePathName, FileName, Value
ImageName=UploadRequest.Item("ImageName" ).Item("Value")
ImageName=replace(ImageName, "'", "''")
on error resume next
ContentType =UploadRequest.Item("File").Item("C ontentType")
FILEFLAG = err.number
on error goto 0
if FILEFLAG = 0 then
ContentType = UploadRequest.Item("File").Item("Co ntentType")
FilePathName = UploadRequest.Item("File").Item("Fi leName")
FileName = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
Value = UploadRequest.Item("File").Item("Va lue")
else
FileName = ""
end if
if filename<>"" then
adoCn.Execute("INSERT INTO images (ImageName, FileName, MimeType) VALUES ('" & ImageName & "','" & FileName & "', '" & ContentType & "')")
adoRs.open "select top 1 * from Images order by ImageID DESC", adoCn, 1, 3
if not adoRs.eof then
adoRs.Fields("Bindata").appendChunk value & chrB(0)
adoRs.Update
adoRs.close
end if
end if
set UploadRequest = nothing
End If |