Blue Theme Orange Theme Green Theme Red Theme
 
Click Here for 3 Month Free of ASP.NET Hosting!
Skip Navigation Links
C# Corner Home
Forum Home
Latest 50
Unanswered
Win $500 Cash
All Time Leaders
Jump to CategoryExpand Jump to Category
Login 
    Welcome Guest!
 Search Forum For :  
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id:
Password:  
Forgot Password | Forgot UserName
   Home » ASP.NET & Web Development » Upload/Download files from File Server using ASP.NET 2.0
       
Author Reply
Arun A
posted 2 posts
since Jun 04, 2009 
from

 Upload/Download files from File Server using ASP.NET 2.0
  Posted on: 11/4/2009 2:19:49 PM       
Hi, I would like to create a web page that allows user to upload a file to the file server(mapped to path \\FileServerName\Folder\). On uploading, the file should be displayed as a link on web page. When user clicks on the link he should be able to download or view the uploaded file. Now I am able to write the file to another server location but when i try to download the same file by clicking the hyper link thats created, nothing happens even though the path to network file is correctly set in hyperlink. I have set the impersonation properties n all so asp.net can access files on file server. Your help will be greatly appreciated Thanks in advance Arun
roopa
posted  1 posts
since  Nov 05, 2009 
from 

 Re: Upload/Download files from File Server using ASP.NET 2.0
  Posted on: 11/5/2009 12:46:22 AM       
hi arun , i am trying to do the same. have you stored the file name in some table and then displayed it as a hyperlink in a web page ? my idia is this . do you have any other way ? 2. if the user tryes to upload large file (more than 5kb, which i set in web.config) do you know how to display an error message. Thanks in advance. roopa
Roopa
Arun A
posted  2 posts
since  Jun 04, 2009 
from 

 Re: Upload/Download files from File Server using ASP.NET 2.0
  Posted on: 11/6/2009 5:40:41 PM       
hi roopa, well i am also approaching the problem in similar manner i.e. writing file location into DB table and posting it as a hyperlink. another way would b assign each user a diff directory based on say userid or something .. u can simply use File IO to loop through all files in dir and display as links to user my problem: the file does not open when link is clicked,dont understand why.. even file not found error is not thrown.
kishan gajjar
posted  24 posts
since  Oct 28, 2008 
from  Ahmedabad

 Re: Upload/Download files from File Server using ASP.NET 2.0
  Posted on: 11/18/2009 6:10:19 AM       
Hi... I have developed file sharing system..but i dnt have much space on my server..so i want to save all uploaded files to some other free webspace server...so how can i upload files from my server to some other server... suppose i want to upload my files to www.my3gb.com web server....so can u plz tell me code....
Kishan Gajjar. Visit http://expertamadavadi.com for Hacking and PC Tricks. Send Fake mail in just 1 Click.Visit my website.
home base
posted  82 posts
since  Mar 24, 2009 
from 

 Re: Upload/Download files from File Server using ASP.NET 2.0
  Posted on: 11/18/2009 6:52:47 AM       
Hi,

You can use this code sample
------------------------------------

// For uploading the file


try
{
WebClient oclient = new WebClient();
byte[] responseArray =
oclient.UploadFile(txtURLToSend.Text,"POST",txtFileToSend.Text);
lblStatus.Text =
"Check the file at " + Encoding.ASCII.GetString(responseArray);
}
catch (Exception ex)
{
lblStatus.Text = ex.Message;
}


// For downloading the file


try
{
WebClient oclient = new WebClient();
oclient.DownloadFile(txtURL.Text,txtFileLocation.Text);
lblStatus.Text = "Check the file at " + txtFileLocation.Text;
}
catch (Exception ex)
{
lblStatus.Text = ex.Message;
}
For Articles
Please Check if my answer help to you....

Thanks....
       
Sponsored by
Become a Sponsor
Developer-Ready ASP.NET 2.0 Web Hosting with 3 MONTHS FREE
Now supporting .NET 3.0 Framework with Windows Workflow Foundation, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), windows CardSpace (WCS)! Providing more flexibility for Developers with Web Services Support and a User/Permission Manger. Also supporting MS SQL 2005/2000 with Real-Time Backups, FREE Automated Attach .MDF Tool, FREE SQL Restore and Shrink SQL DB Tools, and SQL
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Clickatell's SMS Gateway
Clickatell's Developer Solutions allow you to SMS enable any website or application via a range of API's. Learn More about our API connections.
Free access to .NET Memory Management video
Everything you need to know about Garbage Collection, Temporary Objects, Fragmentation, Finalization and common causes of memory leaks in .NET. Watch the video here.
Microsoft Visual Studio 2010
Microsoft Visual Studio 2010 offers more to developers than any other Visual Studio release. Work more productively and collaboratively-with greater control over your work at every step. The Beta 2 can give you a head start on achieving efficiency.

 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Advertise with us
Current Version: 3.2009.8.27
 © 1999 - 2009  Mindcracker LLC. All Rights Reserved