Uploading any file from server folder

Asked By Anil Desai
08-Jun-06 02:11 AM
Earn up to 0 extra points for answering this tough question.
I want to download any type of file which is located on server folder. So how i do it?

  re

Asked By Rupali Randhave Kolhe
08-Jun-06 05:26 AM
hi refer link http://www.xefteri.com/articles/show.cfm?id=8

  use the content-disposition header

Asked By J S
08-Jun-06 06:24 AM
If you are using ASP/ASP.NET, you can use the content-disposition header. Its format is: Content-disposition: attachment; filename=fname.ext When Internet Explorer receives the header, it raises a File Download dialog box whose file name box is automatically populated with the file name that is specified in the header. Here is a code snippet in asp.net(C#): private void Button1_Click(object sender, System.EventArgs e) { string strFileToDownload=@"C:\1.jpg"; Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename="+System.IO.Path .GetFileName(strFileToDownload)); Response.WriteFile(strFileToDownload); } You can check this link for more information. HOWTO: Raise a "File Download" Dialog Box for a Known MIME Type http://support.microsoft.com/default.aspx?scid=http://support.microso... 80/support/kb/articles/Q260/5/19.ASP&NoWebContent=1 Hope this helps.
Create New Account
fa the Project Location similar to what we have in Visual studio 2008 HI Try this code private void buttonBrowse_Click(object sender it helps. . . Hi, Like browse we have Fileupload control in .Net please check this As the move is made to more I'll show you how to create a simple ASP.NET Web application that demonstrates uploading a file to a server. The C# code is available I took to build this project. First, you fire up Visual Studio .NET. On the Start Page, click on the New Project button. Choose the following: • Project Type : Visual C# Projects • Templates : ASP NET Web Application • Location : http: / / localhost / FileUpload Once the Web form
Error in Uploading file saying uploading is deny Hi! I created a empty folder called "Server to upload a file to this "Server" folder using ASP.Net, but an error occur: Error: Access to the path "C MyFile.PostedFile.FileName Dim fn As String = System.IO.Path.GetFileName(strFileName) ' only the attched file name not its path Dim HTML> <HEAD> <title> frmUpload< / title> <meta name = "GENERATOR" content = "Microsoft Visual Studio .NET 7.1"> <meta name = "CODE_LANGUAGE" content = "Visual Basic .NET 7.1"> <meta name = "vs_defaultClientScript" content = "JavaScript"> <meta name = "vs_targetSchema these operations. Check to make sure the file you are uploading is not going to overwrite an existing file. You can
this image path. . when page loads. . i am using asp.net C# with visual studio 2008 and sql server 2005. thanx in advance. . hi, use this below uploading images in File System and storing image paths in the EventArgs e) { / / Get Filename from fileupload control string filename = Path.GetFileName(fileuploadimages.PostedFile.FileName); / / Save images into Images folder fileuploadimages.SaveAs was quite easy to wrap this up as an ASP.NET control . Design Objectives The design objectives of the control : • Display window size. Using the ThumbViewer Control In the Toolbox in Visual Studio 2005 right-click and select "Choose Items. . .". On the Choose you can try this also When you are saving or uploading file to your directory on server, it needs Rooted path refer that directory and get the uploaded image just after uploading, see the small code snippet protected void btn_Click( object sender
Unable to upload file using ASP.net webservices. Even if the file is on desktop, it is have tried the same code. String strFile = System.IO. Path .GetFileName(filename); I want to get the entire path of the uploading file. please tell me how to do that. Im new to dot net. use this snippet String strFile = System.IO. Path .GetFullPath(filename IO. Path .GetFullPath(filename); TextBox1.Text = strFile; } Even when Im uploading any file from Desktop, always the highlighted path is being shown. C: \ Program Files \ Microsoft Visual Studio 9.0 \ Common7 \ IDE \ Scrum_05-04 _A.XLS Even when Im uploading any file from Desktop, always the highlighted path is being
Image upload using FIle upload control hi, in my asp.net web application, i have taken one webform named "Default2.aspx to do this?? pls give any solution! i m using Visual studio 2010! In the button click you can write this code ID = "Image1" runat = "server" / > And here's the code for uploading the image to a folder. CODE BEHIND: 1: protected void if for example is located in E: \ Practice \ Sample \ Asp.net \ Lab1 say this is the path of your application so sender, EventArgs e) { if (FileUploadControl.HasFile) { try { string filename = Path.GetFileName(FileUploadControl.FileName); FileUploadControl.SaveAs(Server.MapPath( " ~ / " ) + filename); StatusLabel.Text = " Upload follows: Upload button_click. . if (FileUpload1.HasFile) { try { string filename = Path.GetFileName(FileUpload1.FileName); FileUpload1.SaveAs(Server.MapPath("~ / images") + filename); Label26.Text images to be uploaded into image control) the image is uploading into image control successfully. . . at the same time image was it is not a huge problem. The problem is that visual studio does not refresh the folder. Hence you need to manually
this image path. . when page loads. . i am using asp.net C# with visual studio 2008 and sql server 2005. thanx in advance. . First you ImageUrl = "status / available.jpg" ; HI When you are saving or uploading file to your directory on server, it needs Rooted path refer that directory and get the uploaded image just after uploading, see the small code snippet protected void btn_Click( object sender image has been uploaded, see the following snapshot of before uploading and after uploading refer this code public string GetConnectionString() { / / sets the connection string memoryStream.Dispose(); } } public bool IsReusable { get { return false ; } } http: / / geekswithblogs.net / dotNETvinz / archive / 2009 / 04 / 24 / displaying-image-to-image-control comm.Parameters.AddWithValue( "name" , "file1" ); comm.Parameters.AddWithValue( "url" , Path .GetFileName(FileUpload1.PostedFile.FileName)); comm.ExecuteNonQuery(); connection.Close(); } catch ( Exception ex
to upload a file to this "Server" folder using ASP.Net, but an error occur: Error: Access to the path "C MyFile.PostedFile.FileName Dim fn As String = System.IO.Path.GetFileName(strFileName) ' only the attched file name not its path Dim HTML> <HEAD> <title> frmUpload< / title> <meta name = "GENERATOR" content = "Microsoft Visual Studio .NET 7.1"> <meta name = "CODE_LANGUAGE" content = "Visual Basic .NET 7.1"> <meta name = "vs_defaultClientScript" content = "JavaScript"> <meta name = "vs_targetSchema HTML> sorry, I type the wrong word. I am facing uploading file problem, not updating. Is your folder writeable, folder where
Uploading video Hi Friends, I want to upload video files in EventArgs e) { / / / / CODEGEN: This call is required by the ASP.NET Web Form Designer. / / InitializeComponent(); base.OnInit(e); } / / / <summary> / / / Required method ContentLength > 0)) { / / determine file name string sFileName = System.IO.Path.GetFileName(File1.PostedFile.FileName); try { if (File1.PostedFile.ContentLength < = lMaxFileSize) { / / Save sFileDir + sFileName); } } } } } Step 1: Create a new windows application. Open Visual Studio > File > New > Project > Windows Application > Rename it to ‘WindowsPlayAudio’. Step cs, add the following namespace C# using System.Media; VB.NET Imports System.Media Step 3: On the ‘btnOpen’ click, display System.Windows.Forms.DialogResult.OK) { txtFileNm.Text = openFileDialog1.FileName; } VB.NET If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then txtFileNm object sender, AsyncCompletedEventArgs e) { ((System.Media.SoundPlayer)sender).Play(); } VB.NET Private Sub btnPlay_Click(ByVal sender As Object, ByVal e As server path and display in any video player using asp.net c# Create New Account