I have the following code :
Set objUpload = Server.CreateObject("ASPUploadComponent.cUpload")
It seems to be failing, because the following debug code :
Response.Write(" begin ")
Response.Write(" Err : " & Err & " ")
Response.Write(" TypeName(Err) : " & TypeName(Err) & " ")
Response.Write(" Str(Err.Number): " & Err.Number & " ")
Response.Write(" Str(Err.Source): " & Err.Source & " ")
Response.Write(" Str(Err.Description): " & Err.Description & " ")
Response.Write(" TypeName(objUpload) : " & TypeName(objUpload) & " ")
Response.Write(" end ")
Outputs :
begin Err : -2147352567 TypeName(Err) : Object Str(Err.Number): -2147352567 Str(Err.Source): ASPUploadComponent Str(Err.Description): Unhandled error: 007~ASP 0104~Op�ration non autoris�e~ TypeName(objUpload) : Empty end
It says unauthorized operation
.
This exact same way of creating the object works perfectly on some other script, but not here.
What could possibly cause this?
It's different from this question, because you would have to know it's related to the file size to begin with, so while the solution is the same, the other question would have not helped me, because I wouldn't have searched for it in the first place.
So after more digging, I found the actual reason, and it's definately not straight forward.
It is due to the fact that the file I was trying to upload, despite being rather small (1.27 Mb) was exceeding the miaximum size allow by IIS. And, for some reason which I can't explain, instead of letting me know that this was the issue, the COM object would just refuse to be created.
To solve this, one must change the maximum allowed size in the IIS settings as follows :
It's in french, but you'll figure out.