.NETGURU
File upload question
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-io' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Karen Healey
-- Moved from [aspngibuyspy] to [ngfx-io] by Yannick Smits <Click here to reveal e-mail address> --

Hi,

I'm trying to write my own File Upload module for the Portal and am a little confused about WHERE to put the file.

Currently I have:

InputFile.PostedFile.SaveAs("c:\\Temp\\"+ParsedFileName);

Which works great to save the file in c:\Temp.

But I want to save files in the images subdirectory of my portal and I'm not sure how to specify that directory. I don't want to hard code in the directory name (or even put it in web.config). Is there a way to find out where my home directory is for the web page? Then I could just append ~/images to it.

FYI... there are alot of free File Upload controls available but I wanted to give this a try myself since it seemed easy.

Karen

Reply to this message...
 
    
Steve Sharrock (VIP)
Take a look at either Page.MapPath( "~" ) or Server.MapPath( "~" );
You could also use MapPath("Images") -- (or something like this).

HTH
Steve Sharrock
programmer / designer
www.sharkcode.com

-----Original Message-----
From: Karen Healey [mailto:Click here to reveal e-mail address]
Sent: Saturday, September 07, 2002 4:13 AM
To: ngfx-io
Subject: [ngfx-io] File upload question

-- Moved from [aspngibuyspy] to [ngfx-io] by Yannick Smits
<Click here to reveal e-mail address> --

Hi,

I'm trying to write my own File Upload module for the Portal and am a
little confused about WHERE to put the file.

Currently I have:

InputFile.PostedFile.SaveAs("c:\\Temp\\"+ParsedFileName);

Which works great to save the file in c:\Temp.

But I want to save files in the images subdirectory of my portal and I'm
not sure how to specify that directory. I don't want to hard code in
the directory name (or even put it in web.config). Is there a way to
find out where my home directory is for the web page? Then I could just
append ~/images to it.

FYI... there are alot of free File Upload controls available but I
wanted to give this a try myself since it seemed easy.

Karen
| [ngfx-io] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-io.asp = JOIN/QUIT

Reply to this message...
 
    
Karen Healey
Thanks Steve for pointing me in the right direction. Here is the line of
code I used...
string SaveAsFileName = Page.MapPath( "~\\images" ) + "\\" + ParsedFileName;

Thanks!

Karen

----- Original Message -----
From: "Steve Sharrock" <Click here to reveal e-mail address>
To: "ngfx-io" <Click here to reveal e-mail address>
Sent: Wednesday, August 07, 2002 19:26
Subject: [ngfx-io] RE: File upload question

[Original message clipped]

Reply to this message...
 
    
Biplab De
Hi,

U can use Request.ServerVariables("APPL_PHYSICAL_PATH") to get physical path of UR portal's Vartual path.

Biplab De.

--- "Karen Healey" <Click here to reveal e-mail address> wrote:
[Original message clipped]

_____________________________________________________________
Washington DC's Largest FREE Email service. ---> http://www.DCemail.com ---> A Washington Online Community Member --->
http://www.DCpages.com

_____________________________________________________________
Promote your group and strengthen ties to your members with Click here to reveal e-mail address by Everyone.net http://www.everyone.net/?btn=tag

Reply to this message...
 
    
Brian Bilbro (VIP)
The portal has an example of using the FileUpload capabilities of .NET.
Check out the EditDocs.aspx file in the DesktopModules folder.

--
Brian

[Original message clipped]

directory name (or even put it in web.config). Is there a way to find out
where my home directory is for the web page? Then I could just append
~/images to it.
[Original message clipped]

Reply to this message...
 
 
System.Web.UI.Page




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification