How to work around Visual FoxPro's 16 Megabyte String Limit
January 19, 2012 • N/A
Rick - Thanks for looking into my original request and coming up with this really helpful article. Historically I used FTP for most everything inside of our desktop app, but found more and more issues with firewalls so I transitioned to HTTP. This is going to help tremendously.
Thanks Rick... I didn't know this...
Is this this now an option on the FileUpload control?
@Jim - unfortunately not. The problem on the server side is that the Server Response comes in encoded. It's one buffer that has all the mime encoding in it and that needs to be decoded - ie. the string has to be manipulated.
your code Hello Rick, there is simple workaround also for passing string greather than 16 meg to AddPostKey method. Solution is parse tcValue string into chunks smaller than 16,777,184 B using SUBSTRING() and add this chunks to THIS.cPostBuffer using THIS.cPostBuffer=THIS.cPostBuffer + lcChunk
Hello Rick, thanks for sharing
Just wanted to say that when i use your wwFileStream with big files (250MB-500MB) it doesnt work probably. You will get the Error "There is not enough memory to complete this operation (Error 43)"
So i changed the WriteFile Methode to this, so at least this function will work again
************************************************************************
FUNCTION WriteFile(lcFileName) LOCAL ln_Handle
*THIS.Write(FILETOSTR(lcFileName)) m.ln_Handle = FOPEN(FULLPATH(m.lcFileName)) DO WHILE NOT FEOF(m.ln_Handle) THIS.nLength = THIS.nLength + FWRITE(this.nHandle,FREAD(m.ln_Handle, 65535)) ENDDO =FCLOSE(m.ln_Handle) ENDFUNC
Also the ToString() Method wont work with big files, so you have to avoid using this method. I tried to read the file with FREAD() but the Error still pops up. Maybe this information helps somone
cheers Tobias
Hi Rick,
Can't find 'oPostStream' and 'cPostStreamClass' in WC6's wwHTTP. Did you implement these properties somewhere else?
Thanks
Hi Rick,
Attempted to modify wc6/classes/wwAPI > EncodeDBF() to support files larger than 16Meg, couldn't work it out, any idea why?
FUNCTION EncodeDBF
LPARAMETERS lcDBF, llHasMemo, lcEncodedName
LOCAL lcResult, lcFPT
lcDBF = Iif(Vartype(m.lcDBF)="C", Upper(ForceExt(m.lcDBF, 'dbf')), "")
if !File(m.lcDBF)
return ''
endif
lcFPT = ForceExt(m.lcDBF, 'fpt')
llHasMemo = m.llHasMemo and File(m.lcFPT)
lcEncodedName = Evl(m.lcEncodedName, JustFname(m.lcDBF))
lcResult = '';
+ "wwDBF"; && 5
+ Padr(m.lcEncodedName, 40);
+ Str(Len(FileToStr(m.lcDBF)), 10);
+ Iif(m.llHasMemo;
, Padr(ForceExt(m.lcEncodedName, "fpt"), 40);
+ Str(FileToStr(m.lcFPT), 10);
, Space(50);
);
+ ''
lcResult = m.lcResult + FileToStr(m.lcDBF) && 2016-03-14 thn -- {en} attempt to work around the 16 MB VFP limitation - https://www.west-wind.com/wconnect/weblog/ShowEntry.blog?id=882
&& 2016-03-15 thn -- {en} _cliptext = m.lcResult
&& 2016-03-15 thn -- {en} wwDBFAWADAPTERDETAIL.DBF 19106822 && 18,22 MB
&& 2016-03-15 thn -- {en} String is too long to fit (Error 1903)
lcResult = m.lcResult + Iif(m.llHasMemo;
, FileToStr(m.lcFPT);
, '';
)
return m.lcResult
ENDFUNC
Sean Gowens
January 19, 2012