views:

186

answers:

2

I want to write one program by visual studio 2008 (C# and ASP) that has web application and windows application.

I want to get clients images in web app(upload) and store them in DB (mysql) then send these images to windows app via web service (so i new web service, not web site). But i have 2 problems:

  1. I have 2 ways to store images in mysql, first i should have BLOB field in DB -that it takes more space-, second i should save just name of each image in DB(so have image in one folder) -in this way i don't know how get image from clients and store them in that folder-. which one? Or what other?

  2. How (code) can i transfer image via web service(Byte[] or? ).

+2  A: 

One of the options to transfer the image using WCF is to convert image to byte array and pass it to client. Then convert from byte[] to image on client side.

Incognito
A: 

Question 1:

The images or links in DB debase is old and still unresolved. There was a microsoft white paper that came out that recommended (for SQL Server 2008, so your mileage may vary) that for images/binaries under 150k DB storage is a good compromise. If most images are over, go with links, if under, store in DB.

Question 2:

The webservice will have an http context object, so you could simply use the Response.BinaryWrite method, that takes a byte[]. You will still need to write the correct headers (for mime type etc).

For a file on disk, the simplest thing to do is use the Response.WriteFile method that takes a file path argument.

In either case, you will need to intercept this on the client and convert back to an image.

Oded