Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 22nd, 2011, 01:53 PM
Authorized User
Points: 265, Level: 5
Points: 265, Level: 5 Points: 265, Level: 5 Points: 265, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2010
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reg. File upload control?

Hi.
I would like to develop a dynamic site inwhich site adminstrator has facility to upload the image as per choice. For that I am using file upload control . I was searching in google and got a useful code. But that code do not fulfill my requirement completely. So please help me in this regard. The code is as follows.

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
Label3.Text = "";

}
protected void Button1_Click(object sender, EventArgs e)
{
if( FileUpload1.HasFile)
{

FileUpload1.SaveAs("D:/Projects/" + FileUpload1.FileName);
Label3.Text = "File " +FileUpload1.FileName+ " is Uploaded";
}
else
Label3.Text = "No uploaded file";

}


}


There is a folder in D drive named project and when I upload any file using file upload control and click the submit button it file got stored in the specified folder. Similarly MY concept is that I provide the path of server (with user name and password if requred) and specify the folder of server in which I would like to upload the file and my file got uploaded on the server in the same way.


FileUpload1.SaveAs("D:/Projects/" + FileUpload1.FileName);


as in above programming . But I am unable to under stand what should be progarmming for that.

The server information is as follows.

Host Name - 216.151.164.37
username - w00115535
password - qL7Q*x.9

I would like to upload the file in wwwroot folder.

Pls help me in this regard.
thank you.
Reply With Quote
  #2 (permalink)  
Old September 23rd, 2011, 02:44 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Unless both machines are on the same network, this either can't easily be done, or you need crazy security settings. If the machines are on the same network, you could save it at \\Servername\Share.

Otherwise, you need a mechanism at the other server to accept the file in a different way. Options that come to mind are FTP or a web service.

Can you please post questions not directly related to my book(such as this one) in a more general ASP.NET category: http://p2p.wrox.com/asp-net-4-539/

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Container Control not working with Reg Free COM - Manifest File ashu_from_india Pro VB 6 0 June 17th, 2010 07:31 AM
Clear the filepath details of File Upload Control after saving a file DineshGirij008 C# 2005 0 March 7th, 2009 03:52 AM
File Upload Control surendraparashar ASP.NET 2.0 Professional 6 November 6th, 2007 07:39 AM
File upload control miltonsnider BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 December 12th, 2006 06:03 AM
file upload control brasi12345 ASP.NET 2.0 Professional 0 May 11th, 2006 05:47 AM



All times are GMT -4. The time now is 12:00 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.