1

I have to upload photo to a folder in a HTTP server from a window application using web-service.I have converted the photo into stream and passed to a web-service but how can i save it to a location (eg: http:/siteaddress/images/photos/) in the server.

0

1 Answer 1

2

the web service has to get the stream from the client and convert it back to file in the location you mentioned.

string destinationFolder = Server.MapPath("/images/photos");

then assuming that in your web method you get a stream and a string with a unique file name, you save the steam into such file name in the destinationFolder above.

if you want to generate a unique name you can create a GUID, I'm sure you will need also the id of the user or so, just to save somewhere who has uploaded this photo.

the destination folder like images/photos should be taken from an app setting in the web.config or from the database, not hardcoded as in my example.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.