954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Please help me with FileUpload :)

Hello all and thank you in advance.

I am building a website (AP.NET 3.5 and C#) that I put a File Uploader on using the "FileUpload". I then created a Button that has the following code in it:


String savePath = @"DESTINATION_PATH";
if (FileUpload1.HasFile)
{
String fileName = FileUpload1.FileName;
savePath += fileName;
FileUpload1.SaveAs(savePath);
UploadStatusLabel.Text = "Your file was Uploaded";
}


I set the DESTINATION_PATH to my Desktop to test it and it worked. Now, I want to direct the destination to my hosting account through GoDaddy.
So, I first set the permissions on the folder on the server for (Read/Write). I have the absolute path, username, and password to my hosting
account. However, I do not know how to proceed. Where and how would I put the credentials so I connect with GoDaddy? The "where" part of the
answer is important :) Please help me, it's somewhat very important to me. Thank you again and take care :)


Mamoon

184100
Newbie Poster
1 post since Jul 2011
Reputation Points: 10
Solved Threads: 0
 

You can use MapPath to get the folder structure for the DESTINATION_PATH:

String FilePath;
FilePath = Server.MapPath("/MyWebSite");


http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx

stbuchok
Master Poster
730 posts since May 2011
Reputation Points: 120
Solved Threads: 93
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: