Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Custom file upload to library not working in Safari

$
0
0

Hello,

Using the following to upload a file to a SP picture library. It works in every browser except Safari. Is there something I'm missing here?

        protected void Button1_Click(object sender, System.EventArgs e)
        {
            if (File1.PostedFile != null)
            {
                //SPWeb site = SPContext.Current.Web;
                SPWeb web = SPContext.Current.Site.OpenWeb();
                web.AllowUnsafeUpdates = true;
                Stream fStream = File1.PostedFile.InputStream;
                byte[] contents = new byte[fStream.Length];

                fStream.Read(contents, 0, (int)fStream.Length);
                fStream.Close();

                string Filename = File1.FileName;

                string destUrl = SPContext.Current.Site.Url + "/ProfileImages/" + Filename;

                web.Files.Add(destUrl, contents);
            }
        }
any help is appreciated.


sayitfast



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>