Hi All
I'm a web developer and I only have a little understanding of NAV so please have patience with me
I have made a .NET website where you can upload a file to NAV 2009 R2 and later download it through the webservcie.
Edit : The code is based on this post :
http://www.kauffmann.nl/blog/index.php/ ... b-service/
The problem is that one pdf file do not work when downloaded, and when i look at the file content it has been padded with 0x00 and is somewhat larger than the original file.
All other files work, and images are correctly displayed in NAV...
I use this code to upload:
string picture = Convert.ToBase64String(fileupload.FileBytes);
NAVWebservice.SaveFile(ref string filedata); (pseudo code, it's wrapped in a data access layer)
And this code for download (it's a ashx file)
string picture = string.Empty;
NAVWebservice.GetFile(ref string filedata); (pseudo code, it's wrapped in a data access layer)
byte[] buffer = Convert.FromBase64String(picture);
HttpResponse response = HttpContext.Current.Response;
response.ContentType = contenttype ;
response.AppendHeader("content-disposition", "inline; filename=" + filename);
response.ClearContent();
response.OutputStream.Write(buffer,0,buffer.Length);
response.End();
Any suggestions ?
Regards
Anders Thue Pedersen
http://www.andromeda-it.dk
Answers
Regards
Anders