如何打开客户端窗口对话框选择文件 [英] How to Open Window Dialog of Client to select File
问题描述
亲爱的所有
我想打开一个窗口对话框,使用asp.net在客户端PC上选择文件而不使用服务器控制文件眉毛..
我也使用此代码
protected void btntft_Click(object sender,EventArgs e)
{
String Location = String.Empty;
OpenFileDialog frm = new OpenFileDialog();
frm.Filter =;
frm.Title =浏览配置文件;
//frm.InitialDirectory =D:\\;
DialogResult ret = STAShowDialog(frm);
}
private DialogResult STAShowDialog(FileDialog对话框)
{
DialogState state = new DialogState();
state.dialog = dialog;
System.Threading.Thread t = new System.Threading.Thread(state.ThreadProcShowDialog);
t.SetApartmentState(S ystem.Threading.ApartmentState.STA);
t.Start();
t.Join();
return state.result;
}
公共类DialogState
{
public DialogResult result;
公共FileDialog对话框;
public void ThreadProcShowDialog()
{
result = dialog.ShowDialog(); < br $>
}
}
但它不能在IIS服务器上工作
请帮助我如何调用
谢谢
Dear All
I want to open a window dialog for selection of file on client PC using asp.net without using server control file brows..
I m Also Use this Code
protected void btntft_Click(object sender, EventArgs e)
{
String Location = String.Empty;
OpenFileDialog frm = new OpenFileDialog();
frm.Filter = "";
frm.Title = "Browse Config file";
//frm.InitialDirectory = "D:\\";
DialogResult ret = STAShowDialog(frm);
}
private DialogResult STAShowDialog(FileDialog dialog)
{
DialogState state = new DialogState();
state.dialog = dialog;
System.Threading.Thread t = new System.Threading.Thread(state.ThreadProcShowDialog);
t.SetApartmentState(System.Threading.ApartmentState.STA);
t.Start();
t.Join();
return state.result;
}
public class DialogState
{
public DialogResult result;
public FileDialog dialog;
public void ThreadProcShowDialog()
{
result = dialog.ShowDialog();
}
}
But Its Not being work on IIS Server
Please help how can I call
Thanks
推荐答案
你不能:只有用户可以这样做,通过选择上传控件。
You can't: only the user can do that, by selecting an upload control.
这篇关于如何打开客户端窗口对话框选择文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!