- TailleMax=50000
- MonFichier="test.jpg"
- UrlSuivante="page.asp"
-
- taille=Request.TotalBytes
-
- if taille<TailleMax then
- binfich = Request.BinaryRead(taille)
- tmp=""
- for i=1 to LenB(binfich)
- tmp = tmp & chr(ascb(midb(binfich, i, 1)))
- if tmp=left("Content-Type: ",len(tmp)) then
- if tmp="Content-Type: " then exit for
- else
- tmp=""
- end if
- next
-
- tmp=""
- ascfich=chr(13) & chr(10) & chr(13) & chr(10)
- for taille=i+1 to lenb(binfich)
- tmp = tmp & chr(ascb(midb(binfich,taille,1)))
- if tmp=left(ascfich,len(tmp)) then
- if tmp=ascfich then exit for
- else
- tmp=""
- end if
- next
-
- ascfich=""
- for i=taille+1 to lenb(binfich)
- ascfich = ascfich & chr(ascb(midb(binfich,i,1)))
- next
-
- ascfich=left(ascfich,instrrev(ascfich,chr(13) & chr(10),len(ascfich)-3)-1)
-
- if len(ascfich)<>0 then
- set objf=server.createobject("scripting.filesystemobject")
- set fichier=objf.createtextfile(server.mappath(MonFichier),true)
- fichier.write ascfich
- fichier.close:set fichier=nothing
- set objf=nothing
- ch="""Le transfert du document s'est déroulé avec succès !"""
- else
- ch="""Une erreur est survenue : le transfert n'a pas eu lieu..."""
- end if
-
- else
- ch="""Le fichier est trop grand : le transfert n'a pas eu lieu..."""
- end if
- %>
- <script>
- window.alert(<%=ch%>)
- window.location.href=UrlSuivante
- </script>
- <html>
- <head>
- </head>
- <body>
- </body>
- </html>
TailleMax=50000
MonFichier="test.jpg"
UrlSuivante="page.asp"
taille=Request.TotalBytes
if taille<TailleMax then
binfich = Request.BinaryRead(taille)
tmp=""
for i=1 to LenB(binfich)
tmp = tmp & chr(ascb(midb(binfich, i, 1)))
if tmp=left("Content-Type: ",len(tmp)) then
if tmp="Content-Type: " then exit for
else
tmp=""
end if
next
tmp=""
ascfich=chr(13) & chr(10) & chr(13) & chr(10)
for taille=i+1 to lenb(binfich)
tmp = tmp & chr(ascb(midb(binfich,taille,1)))
if tmp=left(ascfich,len(tmp)) then
if tmp=ascfich then exit for
else
tmp=""
end if
next
ascfich=""
for i=taille+1 to lenb(binfich)
ascfich = ascfich & chr(ascb(midb(binfich,i,1)))
next
ascfich=left(ascfich,instrrev(ascfich,chr(13) & chr(10),len(ascfich)-3)-1)
if len(ascfich)<>0 then
set objf=server.createobject("scripting.filesystemobject")
set fichier=objf.createtextfile(server.mappath(MonFichier),true)
fichier.write ascfich
fichier.close:set fichier=nothing
set objf=nothing
ch="""Le transfert du document s'est déroulé avec succès !"""
else
ch="""Une erreur est survenue : le transfert n'a pas eu lieu..."""
end if
else
ch="""Le fichier est trop grand : le transfert n'a pas eu lieu..."""
end if
%>
<script>
window.alert(<%=ch%>)
window.location.href=UrlSuivante
</script>
<html>
<head>
</head>
<body>
</body>
</html>