Last post May 20, 2009 05:52 PM by wheel0513
May 19, 2009 11:51 AM|wheel0513|LINK
absolute or direct path for my Windows ASP hosting account?
May 19, 2009 12:17 PM|hugonne|LINK
You didn't post your code, but the line you should use is:
May 19, 2009 01:32 PM|HostingASPNet|LINK
What code you have used to set up a fileupload control?
May 19, 2009 03:37 PM|wheel0513|LINK
May 19, 2009 03:40 PM|hugonne|LINK
I was thinking, and i might have misguided you a little. Use Server.MapPath instead of Environment.CurrentDirectory, because this last one will give the
path where the application started (.NET Framewrok speaking), no the path
of the application itself. Try this:
<asp:FileUpload ID="testFileUpload" runat="server" />
<asp:Button ID="testButton" runat="server" onclick="testButton_Click" Text="Button" />
protected void testButton_Click(object sender, EventArgs e)
string fileName = testFileUpload.FileName;
string savePath = Server.MapPath("/") + fileName;
The SaveAs method requires an absolute path (a path thata starts at the root). Remeber that the folder you're copying the file to shaul have write permissions for the ASPNET accunt.
I also editted the previous post so that no one gets confused.
May 19, 2009 09:36 PM|carl.steinhart|LINK
I believe that in order for you to find out the absolute path, you need to contact your current host directly. Every host has its own server configuration and one host may configure your site to point to "C:\Inetpub\Clients", but other host may point your default
site folder to, let's say, D:\Hosting\Clients.
Since you are looking for the "absolute path", you have no other way but to contact your current host to find it out. If they are clueless about your request, just request them to go the the IIS, right click your domain -> Properties.
Then, please just go to the "Home Directory" tab and it should show your site "absolute path"
I am not sure why you have to code using absolute path as if you change host, you will have to change this path again. I highly recommend you to change it to "relative path" so it will not bother you anymore in case you are changing host in the future. Hope
May 20, 2009 05:52 PM|wheel0513|LINK