选择下拉项后如何打开其他目录文件夹 [英] How to open a different directory folders after selecting dropdown item
问题描述
海,
我对文件上传有一些疑问.假设是否有一个下拉列表,一个文件上传控件和一个按钮.如果我们选择一个特定的项目并单击文件上传,它应该转到一个本地目录(例如C:/Tally /...).然后选择第二个项目,然后单击文件上传,它应该进入另一个目录(例如D:/Folder/...).我们该怎么做.我使用javascript进行了尝试.不可能.请与我分享如何执行此操作.
以下是示例代码
Hai,
I have some doubts in file upload.Suppose if there is one drop down list,one file upload control and a button.If we select a particular item and click on file upload it should go to one local directory(For eg C:/Tally/...).Then select the second item and click on file upload it should go another directory(For eg D:/Folder/...).How can We do this.I tried it by using javascript.But it''s not possible.Plz share me how to do this.
Below is a sample code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table align="center">
<tr>
<td>
Restrict File Upload sample <br />
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
</asp:DropDownList>
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />
<br />
<asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
在此先感谢
Sridhar
Thanks in Advance
Sridhar
推荐答案
就像我昨天说的那样,您必须在服务器端代码(而不是javascript)中处理此问题,因为上传控件不会在任何地方存储任何内容.
返回MSDN,查看文件上传控件 [ ^ ]并阅读通过链接.他们甚至为您提供了示例-尝试跟随它们...
As I said yesterday, you have to handle this in Server side code - not javascript - as the upload control does not store anything anywhere.
Go back to MSDN, look at the FileUpload control[^] and read through the links. They even give you examples - just try following them...
这篇关于选择下拉项后如何打开其他目录文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!