Hi,
I use VS FoxPro 6.5
I have an ASP.NET page with a Fileupload control on it for uploading pictures.
I send the data via COM interop to a FoxPro COM object
Within FoxPro I try to write the file to disk as:
Displaying the image with windows image viewer doesn't work, when I open the file with a text reader I see a lot of question marks. Not all data gets converted from asp.net to FoxPro in the right way. How to fix this?
First line in jpeg:
Question, how to fix this?
Going the other way around, using filetostr() I found out that I had to Encode the string send over from my FoxPro COM object to get a readable image in the browser. It has to do with the Unicodes and ANSI used with VFP6.5 but I don't know how to fix this. Anyone any ideas?
I use VS FoxPro 6.5
I have an ASP.NET page with a Fileupload control on it for uploading pictures.
I send the data via COM interop to a FoxPro COM object
Code:
using (StreamReader inputStreamReader = new StreamReader(myfile.PostedFile.InputStream))
{
oVfp.SaveMyImage(inputStreamReader.ReadToEnd());
}
Within FoxPro I try to write the file to disk as:
Code:
strtofile(myFile, "myimage.jpg")
Displaying the image with windows image viewer doesn't work, when I open the file with a text reader I see a lot of question marks. Not all data gets converted from asp.net to FoxPro in the right way. How to fix this?
First line in jpeg:
Code:
???? JFIF ?? ;CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), quality = 80
Question, how to fix this?
Going the other way around, using filetostr() I found out that I had to Encode the string send over from my FoxPro COM object to get a readable image in the browser. It has to do with the Unicodes and ANSI used with VFP6.5 but I don't know how to fix this. Anyone any ideas?
Code:
MemoryStream ms = new MemoryStream(Encoding.Default.GetBytes(cImage));
HttpContext.Current.Response.ContentType = "image/jpeg";
ms.WriteTo(HttpContext.Current.Response.OutputStream);