Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Set objHTTP = CreateObject("Microsoft.XMLHTTP") 
objHTTP.Open "GET", "http://URL/" & nomeFile, False 
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)
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 
  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.

share|improve this question
We partially solved the matter stopping the antivirus and using the ADODB.Stream. Anyway, any solutions are welcome. – IssamTP Sep 16 '10 at 9:16

The error message

Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument

while uploading files is probably related to the server. It may not support some of the newer functions of VBScript.

Maybe it has an older or outdated version of the Microsoft Data Access Components (MDAC) and/or VBScript.

By the way, shouldn't you use the


method when writing binary data?

Also, I would issue Response.Clear() and set the right HTTP response header (according to the files MIME type): Response.ContentType = "...".

share|improve this answer
Thank you for your answer, we've analyzed your suggestions, but unfortunately we couldn't find the solutions. Anyway, just to be sure, we've posted the whole code of the original file "trasferisci.asp", hoping that this will help to fix. – IssamTP Sep 15 '10 at 13:07
The DLL version is 8.100.1051.0 – IssamTP Sep 15 '10 at 13:34
okay, I see. I just don't understand why you're creating text files if you could save them as binary files. Is there a special reason? I guess the problem could be some strange strings being created from your binary content (image). Also, it could be a problem if browsers/sites use different text encodings (Windows-1252, UTF8, ...) – splattne Sep 15 '10 at 13:39
Yes, technically it would be better using ADODB.Stream, but the main web programmer says that it causes troubles with anti-virus. – IssamTP Sep 15 '10 at 13:42
up vote 0 down vote accepted

It was a trouble with our antivirus GData. We've solved it partially disabling the program. In the next release we hope that this will be fixed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.