save png file in application image folder in silve

2019-08-02 08:44发布

I save a png file using silverlight. But I want to save it in application IMG folder. My code is as follows:

if (lastSnapshot != null)
        {
            string ImageName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString()
            + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".png"; 
            string filePath=System.IO.Path.Combine("~/Images/", "" + ImageName + "");  
            using (var pngStream = GetPngStream(lastSnapshot))
            using (var file = File.Create(filePath))
            {
                byte[] binaryData = new Byte[pngStream.Length];
                long bytesRead = pngStream.Read(binaryData, 0, (int)pngStream.Length);
                file.Write(binaryData, 0, (int)pngStream.Length);
                file.Flush();
                file.Close();
            }

        }

I want to do it in silverlight. Can I do it? Can I save file directly in application folder? How to do it? I'll be grateful to anyone who will help me. Thanks in advance.

Adjacent question of mine

1条回答
Root(大扎)
2楼-- · 2019-08-02 09:25

You will have to provide a webservice or upload url at the server side and use that from within Silverlight at the client.

Silverlight applications to NOT have direct access the the server's folders because Silverlight executes at the client.

查看更多
登录 后发表回答