473,480 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Create 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.CreateObject("Scripting.FileSystemObject")
'### This Works
'###Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath("body.txt"))
'### This Doesnt work
Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath(" &
request.form("MyFileName") & "))

WHILE NOT MyTextFile.AtEndOfStream
Response.Write(MyTextFile.ReadLine & Chr(10))
WEND
MyTextFile.Close
%>
Thanks in advance!
Jul 22 '05 #1
3 1680
strTemp = Request.Form("MyFileName")

Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath(strTemp))

Or

Set MyTextFile =
MyFileObj.OpenTextFile(Server.MapPath(Request.Form ("MyFileName")))

--
Regards

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

Keeping it FREE!

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

<%
Set MyFileObj = Server.CreateObject("Scripting.FileSystemObject")
'### This Works
'###Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath("body.txt"))
'### This Doesnt work
Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath(" &
request.form("MyFileName") & "))

WHILE NOT MyTextFile.AtEndOfStream
Response.Write(MyTextFile.ReadLine & Chr(10))
WEND
MyTextFile.Close
%>
Thanks in advance!

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

Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath(strTemp))

Or

Set MyTextFile =
MyFileObj.OpenTextFile(Server.MapPath(Request.Form ("MyFileName")))

--
Regards

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

Keeping it FREE!

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

<%
Set MyFileObj = Server.CreateObject("Scripting.FileSystemObject")
'### This Works
'###Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath("body.txt"))
'### This Doesnt work
Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath(" &
request.form("MyFileName") & "))

WHILE NOT MyTextFile.AtEndOfStream
Response.Write(MyTextFile.ReadLine & Chr(10))
WEND
MyTextFile.Close
%>
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******@alltel.net> wrote in message
news:uU**************@tk2msftngp13.phx.gbl...
Thanks a bunch!!!
"Steven Burn" <so*******@in-time.invalid> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
strTemp = Request.Form("MyFileName")

Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath(strTemp))

Or

Set MyTextFile =
MyFileObj.OpenTextFile(Server.MapPath(Request.Form ("MyFileName")))

--
Regards

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

Keeping it FREE!

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

<%
Set MyFileObj = Server.CreateObject("Scripting.FileSystemObject")
'### This Works
'###Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath("body.txt"))
'### This Doesnt work
Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath(" &
request.form("MyFileName") & "))

WHILE NOT MyTextFile.AtEndOfStream
Response.Write(MyTextFile.ReadLine & Chr(10))
WEND
MyTextFile.Close
%>
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
1737
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...
11
2091
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 =...
1
1204
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 =...
1
2800
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...
5
1991
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...
1
1088
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...
2
1328
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
1774
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...
2
2746
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......
1
6732
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...
0
6886
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5324
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,...
1
4768
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...
0
4472
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2990
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...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1294
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 ...
0
174
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...

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.