473,883 Members | 2,150 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing string to Server.MapPath

How can I pass the results of a form field submitted to this statement
below?

<%
Set MyFileObj = Server.CreateOb ject("Scripting .FileSystemObje ct")
'### This Works
'###Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath("body.t xt"))
'### This Doesnt work
Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath(" &
request.form("M yFileName") & "))

WHILE NOT MyTextFile.AtEn dOfStream
Response.Write( MyTextFile.Read Line & Chr(10))
WEND
MyTextFile.Clos e
%>
Thanks in advance!
Jul 22 '05 #1
3 1691
strTemp = Request.Form("M yFileName")

Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath(strTemp ))

Or

Set MyTextFile =
MyFileObj.OpenT extFile(Server. MapPath(Request .Form("MyFileNa me")))

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Jake" <sp******@allte l.net> wrote in message
news:#u******** ******@TK2MSFTN GP15.phx.gbl...
How can I pass the results of a form field submitted to this statement
below?

<%
Set MyFileObj = Server.CreateOb ject("Scripting .FileSystemObje ct")
'### This Works
'###Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath("body.t xt"))
'### This Doesnt work
Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath(" &
request.form("M yFileName") & "))

WHILE NOT MyTextFile.AtEn dOfStream
Response.Write( MyTextFile.Read Line & Chr(10))
WEND
MyTextFile.Clos e
%>
Thanks in advance!

Jul 22 '05 #2
Thanks a bunch!!!
"Steven Burn" <so*******@in-time.invalid> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
strTemp = Request.Form("M yFileName")

Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath(strTemp ))

Or

Set MyTextFile =
MyFileObj.OpenT extFile(Server. MapPath(Request .Form("MyFileNa me")))

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Jake" <sp******@allte l.net> wrote in message
news:#u******** ******@TK2MSFTN GP15.phx.gbl...
How can I pass the results of a form field submitted to this statement
below?

<%
Set MyFileObj = Server.CreateOb ject("Scripting .FileSystemObje ct")
'### This Works
'###Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath("body.t xt"))
'### This Doesnt work
Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath(" &
request.form("M yFileName") & "))

WHILE NOT MyTextFile.AtEn dOfStream
Response.Write( MyTextFile.Read Line & Chr(10))
WEND
MyTextFile.Clos e
%>
Thanks in advance!


Jul 22 '05 #3
Your welcome.....

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Jake" <sp******@allte l.net> wrote in message
news:uU******** ******@tk2msftn gp13.phx.gbl...
Thanks a bunch!!!
"Steven Burn" <so*******@in-time.invalid> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
strTemp = Request.Form("M yFileName")

Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath(strTemp ))

Or

Set MyTextFile =
MyFileObj.OpenT extFile(Server. MapPath(Request .Form("MyFileNa me")))

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Jake" <sp******@allte l.net> wrote in message
news:#u******** ******@TK2MSFTN GP15.phx.gbl...
How can I pass the results of a form field submitted to this statement
below?

<%
Set MyFileObj = Server.CreateOb ject("Scripting .FileSystemObje ct")
'### This Works
'###Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath("body.t xt"))
'### This Doesnt work
Set MyTextFile = MyFileObj.OpenT extFile(Server. MapPath(" &
request.form("M yFileName") & "))

WHILE NOT MyTextFile.AtEn dOfStream
Response.Write( MyTextFile.Read Line & Chr(10))
WEND
MyTextFile.Clos e
%>
Thanks in advance!



Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1749
by: Dave | last post by:
I have two sites: www.site_A.com & www.site_A_news.com Site_A is in d:\webs\site_a & uses an Access DB in d:\webs\site_a\data\db.mdb Site_A_news is in d:\webs\site_a\site_a_news also requires access to that Access Database.
11
2122
by: Dthmtlgod | last post by:
I am having a little difficulty in passing a value from a page to another page. I am going to provide excerpts from the code. I think I am close. This is from Page1.ASP <% Set Conn = Server.CreateObject("ADODB.Connection") DSNtest="DRIVER={Microsoft Access Driver (*.mdb)}; " DSNtest=dsntest & "DBQ=" & Server.MapPath("ncci.mdb") Conn.Open DSNtest
1
1215
by: Kishore | last post by:
Hi, I want to convert a microsoft project file into xml file.. Below is the code : <% Dim a Set a= Server.CreateObject("MSProject.Application") Dim objFSO Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
1
2820
by: DagoFlores | last post by:
Hello, I am trying to pass a parameter through C# using a XsltArgumentList class to a xsl:param element, but I dont know if it is possible to do. And also I am trying to get the count of this node too, that has as name the value of the parameter. The "DateElementName" value is the name of a selected node that I want to know the count on the xml file. Any ideas? Thank you.
5
2019
by: john smithers | last post by:
I'm trying to modify the connection string made by the dataadapter wizard to a relative path. My current datasource is this: ""C:\Inetpub\wwwroot\database\database.mdb"" How can i change so when its on the server it will look for the directory "database" in the root of the virtual directory? cheers
1
1103
by: Lelle | last post by:
sorry for crossposting im not sure i was in the right group hello i want to parse/rplace/construct wahtever a string i get i read with directoryinfo out the root off my webapplikation Dim dirInfo As New DirectoryInfo(Server.MapPath("")) c:\inetpub\wwwroot\TEST i store this in a variable called physicalbasepath
2
1344
by: eitan | last post by:
Hello, I put the following code in web.config <appSettings> <add key="ConnectionString" value='PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=Server.MapPath("/db/mydb.mdb")' />
14
1811
by: Josh Baltzell | last post by:
I am having a lot more trouble with this than I thought I would. Here is what I want to do in pseudocode. Open c:\some.pdf Replace "Replace this" with "Replaced!" Save c:\some_edited.pdf I can do this in notepad and it works fine, but when I start getting in to reading the files I think it has some encoding problem. I tried saving the file with every encoding option. When I open a PDF in the
2
2767
by: GaryDean | last post by:
The following command... string DebugString = System.Web.HttpContext.Current.Server.MapPath("App_Themes"); is executed from my ThemeManager.cs class in my App_code directory It returns... "c:\\inetpub\\wwwroot\\TaxBusiness\\AnonymousAccess\\App_Themes" The folders in my website project are... Admin
0
9945
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9798
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10863
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9588
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7978
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5807
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4622
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4230
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3241
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.