我在JAVABEAN或JSP里用文件的读写,这样他只能写到服务器了,怎么才能根据本地客户的要求写到本地客户电脑上文本文件中.
我知道用JAVACRIPT,可不知道怎么用,请大虾们给个思路或有例子的给个,谢谢。

解决方案 »

  1.   

    安全性上不允许。可以考虑写到cookie
      

  2.   

    以下是我从51aspx上下载的源码,保证能用,据说大名鼎鼎的51aspx就是用的这个 if (chkUpload.Checked)
                        {
                            WebClient client = new WebClient();
                            Regex reg = new Regex("IMG[^>]*?src\\s*=\\s*(?:\"(?<1>[^\"]*)\"|'(?<1>[^\']*)')", RegexOptions.IgnoreCase);
                            MatchCollection m = reg.Matches(Editor1.Text);                        foreach (Match math in m)
                            {
                                string imgUrl = math.Groups[1].Value;                            //在原图片名称前加YYMMDD重名名并上传                            Regex regName = new Regex(@"\w+.(?:jpg|gif|bmp|png)", RegexOptions.IgnoreCase);                            string strNewImgName = DateTime.Now.ToShortDateString().Replace("-", "") + regName.Match(imgUrl).ToString();                            try
                                {
                                    //保存图片
                                    client.DownloadFile(imgUrl, Server.MapPath("/UpPics/Auto/" + strNewImgName));                                //替换Url地址
                                    string exUrl = Regex.Replace(imgUrl, @"\w+.(?:jpg|gif|bmp|png)", "");
                                     }
                                catch
                                {
                                }
                                finally
                                { }                        }
                            client.Dispose();