save png file in application image folder in silverlight

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 10:37:09

问题


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:


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.



来源:https://stackoverflow.com/questions/13603030/save-png-file-in-application-image-folder-in-silverlight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!