我想根据相应的链接按钮ID在新窗口中打开我上传的文档。文档以DB中的完整路径保存。
<asp:LinkButton ID="lnkstdres" runat="server" Text='<%#Eval("Alias") %>' CommandArgument='<%#Eval("Idinst") %>' CommandName="StudentRes" OnClick="lnkstdres_Click"></asp:LinkButton>
protected void lnkstdres_Click(object sender, EventArgs e)
{
}
我不知道该怎么做。 谢谢
答案 0 :(得分:0)
if( ( File1.PostedFile != null ) && ( File1.PostedFile.ContentLength > 0 ) )
{
string fn = System.IO.Path.GetFileName(File1.PostedFile.FileName);
string SaveLocation = Server.MapPath("Data") + "\\" + fn;
try
{
File1.PostedFile.SaveAs(SaveLocation);
Response.Write("The file has been uploaded.");
}
catch ( Exception ex )
{
Response.Write("Error: " + ex.Message);
//Note: Exception.Message returns a detailed message that describes the current exception.
//For security reasons, we do not recommend that you return Exception.Message to end users in
//production environments. It would be better to put a generic error message.
}
}
else
{
Response.Write("Please select a file to upload.");
}
答案 1 :(得分:0)
我正在为我的问题发布解决方案。
var name = prompt("What's your name?");
if (name === '') {
name = prompt("Try again");
alert(name);
}