Hi I created button 'UploadDocument' and with popup window after I upload documents using browse in popup window and click ok its should display documents names in 'aspx page' but not displaying please suggest me how to do this...Below is the code
<div id="popup1" class="overlay">
<div class="popup">
<h2>Upload Document</h2>
<a class="close" href="#">×</a>
<div class="content">
<form action="" method="post" enctype="multipart/form-data" name="form" id="form1">
<label>Choose File
<asp:Fileupload ID="FileUpload1" class="multi" runat="server"></asp:Fileupload>
<label> Destination Folder
<asp:Fileupload ID="FileUpload2" class="multi" runat="server"></asp:Fileupload>
<br />
</label>
</form>
<asp:Button ID="btnOk" runat="server" Text="OK" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</div>
</div>
</div>
Private Sub button1_Click(sender As Object, e As EventArgs) HandlesButton1.Click
If FileUpload1.HasFile Then
Try
UploadDocument(FileUpload1.PostedFile.FileName, FileUpload1.FileName)
Catch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
Label1.Text = "You have not specified a file."
End If
End Sub
if u don't have code behind file then how's it work! U have to code on button of file upload.
protected void Button1_Click(object sender, EventArgs e)
{
if (this.FileUpload1.HasFile)
{
this.FileUpload1.SaveAs("c:\\" + this.FileUpload1.FileName);
}
}
Try that in code behind file , Write code for onclick event of Button i.e. Button1
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string path = "D:/"+FileUpload1.FileName
FileUpload1.SaveAs(path);
}
}