简体   繁体   中英

save png file in application image folder in silverlight

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM