如何选择桌面文件夹 [英] How to choose a desktop folder

查看:146
本文介绍了如何选择桌面文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计我的网页,我想要存储图像位置,然后进行客户记录,我正在做照相馆管理工作室系统图像位置而不是存储...

I''m designing my web page i want store image location and then customer record i am doing photo studio management studio system image location not store...

namespace photoshops
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            onflbload(sender, e);
        }
        public void onflbload(object sender, EventArgs e)
        {
            string filename = Server.MapPath("~/photo") + FileUpload.PostedFile.FileName;
            FileUpload.PostedFile.SaveAs(filename);
            SqlConnection connection = new SqlConnection();
            connection.ConnectionString =@"Data Source=DEVI\SQLEXPRESS; Initial Catalog =cat; Integrated Security=SSPI";
               
            try
            {
                connection.Open();
                SqlCommand cmd = new SqlCommand("insert into tblphotosettings "
                 + "(BillNo,CustomerName,Address,StartDate,EndDate,Systemurl,Numberofcopies,Amount,Total ) values (@BillNo,@CustomerName,@Address,@StartDate,@EndDate,@Systemurl,@Numberofcopies,@Amount,@Total)", connection);
                cmd.Parameters.Add("@BillNo", SqlDbType.NVarChar).Value = TextBox1.Text;
                cmd.Parameters.Add("@CustomerName", SqlDbType.NVarChar).Value = TextBox2.Text;
                cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = TextBox3.Text;
                cmd.Parameters.Add("@StartDate", SqlDbType.NVarChar).Value = Rdbsdate.SelectedDate;
                cmd.Parameters.Add("@EndDate", SqlDbType.NVarChar).Value = Rdbddate.SelectedDate;
                cmd.Parameters.Add("@Systemurl", SqlDbType.VarChar).Value = filename;
                cmd.Parameters.Add("@Numberofcopies", SqlDbType.NVarChar).Value = TextBox7.Text;
                cmd.Parameters.Add("@Amount", SqlDbType.NVarChar).Value = TextBox8.Text;
                cmd.Parameters.Add("@Total", SqlDbType.NVarChar).Value = TextBox9.Text;
                cmd.ExecuteNonQuery();
            }
            
            finally
            {
                connection.Close();
            }
        }
    }
}

我的错误
该页面已运行,但选择一个文件窗口,打开如何将图像存储在照片文件夹中我的照片文件夹位于D :(在本地)

my error
the page is run but choose a file window open how to store the image in photo folder my photo folder is on D: (in local)

推荐答案

不确定将适用于Web应用程序...只需尝试

Not sure if it will works for web application...just try

Directory.SetCurrentDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));


不确定我是否理解您的问题,但是如果您要将文件复制到本地目录,那么可能会有所帮助.详细说明您的问题.
not sure I understand your problem, but if you are looking for copying the file to your local directory,then probably this would help. Elaborate your question.
BinaryReader sr = new BinaryReader(this.FileUpload1.FileContent);
FileStream fs = new FileStream(@"C:\" + FileUpload1.FileName, FileMode.Create);
BinaryWriter sw = new BinaryWriter(fs);
//sw.Write(WriteLine(sr.ReadToEnd());
byte[] b = new byte[1024];
int index = 0;
int i;
while ((i = sr.Read(b, 0, 1024)) > 0)
{
    sw.Write(b);
    index += i;
}
//fs.Close();
sw.Flush();
sw.Close();
fs.Close();


由于未明确询问您的问题,我假设您想要的是诸如SaveDialog之类的东西,可以在Winforms中访问,但不能在Web中访问.您可以查看这些链接,以如何拥有自己的另存为"对话框;

链接1 [链接2 [ ^ ]
Since your question is not clearly asked I am assuming you want something like SaveDialog which can be accessible in winforms but not in web. You can check out these links how you can have your own Save As Dialog Box;

Link 1[^]

Link 2[^]


这篇关于如何选择桌面文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆