I have an ASP web service, that allows to various users to put some data in a database and to upload some images. Since the users have different web sites, the web service uploads the image in a first directory in its own space, then calls an ASP web page located in the user's domain passing it the path to the image (correctly stored) as follows:
MResponseBackAsp(Session("Dominio") & "trasferisci.asp?nomefile=" & Session.SessionID & "-" & name)
So, here it comes the trouble, I receive the following message:
Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument
/trasferisci.asp, line 28 Si è verificato un errore nel salvataggio dell'immagine
The code relative to that line is commented:
<%
nomeFile = Request("nomefile")
Dim lStato
Dim objHTTP
Dim strDataIn
'Randomize()
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.Open "GET", "http://URL/" & nomeFile, False
objHTTP.Send
lStato= objHTTP.Status
strDataIn= objHTTP.ResponseBody 'Binario
Set objHTTP = Nothing
If (lStato<>200) Or (Err.Number<>0) Then
problema = "Errore " & lStato & " o " & Err.Description & "."
End If
newNomeFile = right(nomeFile,len(nomeFile)-instr(nomeFile,"-"))
fileDaSalvare = Server.mapPath(Application("news_immagini") & newNomeFile)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(fileDaSalvare) Then objFSO.DeleteFile(fileDaSalvare)
Set objFl = objFSO.CreateTextFile(fileDaSalvare, true)
objFl.Write BinaryToString(strDataIn)
objFl.Close()
Set objFl = Nothing
Set objFSO = Nothing
Function BinaryToString(Binary)
dim c1, c2, c3, p1, p2, p3
Dim L
c1 = 1 : c2 = 1 : c3 = 1
L = LenB(Binary)
Do While c1<=L
p3 = p3 & Chr(AscB(MidB(Binary,c1,1)))
c1 = c1 + 1 : c3 = c3 + 1
if c3>300 then
p2 = p2 & p3
p3 = ""
c3 = 1
c2 = c2 + 1
if c2>200 then
p1 = p1 & p2
p2 = ""
c2 = 1
End If
End If
Loop
BinaryToString = p1 & p2 & p3
End Function
Response.write "salvato"
%>
But the best parts come now: 1) If we call trasferisci.asp manually it works; 2) If we refresh the global.asa then it works again for a while
I read somewhere that there could be some problems whit image upload, where is the problem? Suggestions?
Thank you all folks.
PS (edit): I've posted this question here because we think that the problems are into the System, not into the code. I apologyze if it is not.