I'm having a problem with fpdf files. My page creates a PFD file but in some cases it gives the following error:
Sorry it's in dutch but that's how it works when you work with clients. Anyways it says "File doesn't start with %PDF-. Local\EWH-5128-2
The funny thing is that it does work if I work on the site in localhost. Could this be a server setting?
Hope you guys can help! Thanks in advance!
Solution was as followed:
In my fpdf.asp a temporary PDF-file was created and then deleted before the program could read it.
xfile=Server.MapPath(lib.fso.GetTempName())
xf=lib.fopen(xfile,"wb");
if(xf.number)this.Error("Unable to create output file: " + xfile);
lib.fwrite(xf,this.buffer);
lib.fclose(xf);
outB = Server.CreateObject("ADODB.Stream")
outB.Type = 1
outB.Open()
outB.LoadFromFile (xfile)
Response.BinaryWrite(outB.Read())
outB.Close()
// lib.fso.DeleteFile(xfile);
The problem was solved by deleting the line: lib.fso.DeleteFile(xfile);