I have simple file uploader that posts via a HTML form as multipart/form-data. The receiving WebSpeed code simply does a get-value() to get the file name, and a get-binary-data() to get the actual file contents into a MEMPTR, and then write the results out under a new file name. Simple and easy, working for years.
Running this code under PASOE the code fails. I see the incoming file being written into the a directory (the working directory) as a 0 byte file. The MEMPTR value returns null (either comparing it to ? or doing a GET-SIZE(m)).
Using Classic WebSpeed the same code returns a MEMPTR with the actual file, and the correct size, and it can be written to disk (or wherever) from there.
In PASOE I have binaryUploadMaxSize for the ABL application in question set to a high value, so it's not a limit there. The knowledge base seems to indicate this is the only setting needed to enable binary uploading using the compatibility handler.
Is there something else that needs to be done to support basic binary uploads with classic WebSpeed code under PASOE?
This is under 11.7.2.
Thanks,
Brian
Hi Brian,
I tried with the below code in 11.7.3 and it worked fine for me. I modified fileUploadDirectory and binaryUploadMaxSize properties.
DEFINE VAR mFile AS MEMPTR NO-UNDO. ASSIGN mFile = WEB-CONTEXT:GET-BINARY-DATA("filename"). message get-size(mfile). IF mFile <> ? THEN COPY-LOB FROM mFile TO FILE session:temp-directory + get-value("filename") NO-CONVERT. CATCH e AS Progress.Lang.Error : message e:GetMessage(1). END CATCH.
Irfan,
My code is very similar.
After some testing, I found that there are a few files that will actually work correctly (some older Word and Excel files). They show a normal GET-SIZE(mFile) value relating to their size on disk.
For the files that don't work (which is most that I have tried, including new Excel files, any PDF, and any JPG), the GET-SIZE(mFile) is returning a value like 1,295,547,846 for files that are 11Kb on disk.
All these files work perfectly under Classic WebSpeed.
I'll do some more digging when I get a chance and see what the incoming POST bodies look like to see if I can see any difference between files that work and do not.
Thanks,
Brian
Some firewall somewhere that only allows some file types through?