Comunidad de diseño web y desarrollo en internet online

Subir archivos con Flash 8 y asp

Citar            
MensajeEscrito el 18 Dic 2005 01:49 am
No se si habran muchos que lo puedan utilizar pero aca les dejo el codigo en ASP para recibir y grabar archivos enviados al servidor desde Flash.

<%
server.ScriptTimeout = server.ScriptTimeout * 10
Dim byteDatos, strNomArch
Dim iPosInicio, iPosFin, iPos
Dim iArchIni, iArchFin
Dim oFSO, oFich
Dim i
byteDatos = Request.BinaryRead(Request.TotalBytes)
iPosInicio = 1
iPosFin = InStrB(iPosInicio, byteDatos, str2byte(chr(13)))
byteLimite = MidB(byteDatos, iPosInicio, iPosFin-iPosInicio)
posLimite = InStrB(1, byteDatos, byteLimite)
iPosInicio = InStrB(1, byteDatos, str2byte("filename=")) + 10
iPosFin = InStrB(iPosInicio, byteDatos, str2byte(chr(34)))
strNomArch = byte2str(MidB(byteDatos, iPosInicio, IposFin - iPosInicio))
iPosFin = InStrB(iPosFin, byteDatos, str2byte("Content-Type:"))
iPosFin = InStrB(iPosFin, byteDatos, str2byte(chr(13))) + 4
iArchIni = iPosFin
iArchFin = InStrB(iArchIni, byteDatos, byteLimite)-2
'IE envia el directorio de donde se encuentra el archivo
'FireFox solo envia el nombre del archivo por lo tanto
'nos aseguramos de dejar solo el nombre del archivo
strNomArch1 = ""
do while instr(1, strNomArch, "\") > 0
inicio = instr(1, strNomArch, "\") + 1
strNomArch1 = mid(strNomArch, inicio, len(strNomArch))
strNomArch = strNomArch1
loop
set oFSO = Server.CreateObject("Scripting.FileSystemObject")
set oFich = oFSO.CreateTextFile(server.MapPath("/Imagenes/Menu") & "\" & strNomArch, true)
for i = iArchIni to iArchFin
oFich.Write byte2str(MidB(byteDatos, i, 1))
next
oFich.Close
set oFSO = nothing
server.ScriptTimeout = server.ScriptTimeout / 10
'------------------------------------------------------------------------
Function str2byte ( str )
Dim i, strbuf
for i = 1 to Len(str)
strbuf = strbuf & ChrB(AscB(Mid(str, i, 1)))
next
str2byte = strbuf
End Function
'------------------------------------------------------------------------
Function byte2str ( bin )
Dim i, bytebuf
for i = 1 to LenB(bin)
bytebuf = bytebuf & Chr(AscB(MidB(bin, i, 1)))
next
byte2str = bytebuf
End Function
%>

Por edumaca

8 de clabLevel



Genero:Masculino  

Caracas

firefox
Citar            
MensajeEscrito el 19 Dic 2005 06:49 pm

Por Zandy

Claber

1345 de clabLevel

5 tutoriales

Genero:Masculino   Premio_Secretos

firefox
Citar            
MensajeEscrito el 19 Dic 2005 07:32 pm
Sabía de ese tutorial Sandy, de hecho lo lei, pero el servidor en el que iba a implementar el upload no soporta php asi que tuve que empezar a buscar y probar soluciones de upload en asp.

Eso lo puse en CL por una razon, lo que me habia costado hacer eso en asp y que alguien mas podia necesitarlo.

Es mas que todo un agregado al tutorial que mencionas

Por edumaca

8 de clabLevel



Genero:Masculino  

Caracas

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.