Server.MapPath For Reading From Text File

the source code is:

<%
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.OpenTextFile(Server.MapPath("") & "/learn.txt")
mystring=a.readAll
Response.Write ("<pre>" & mystring & "</pre>")

Set a = Nothing
Set fso = Nothing
%>

The output is:

abc
ABC

i don't understand this:

Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.OpenTextFile(Server.MapPath("") & "/learn.txt")

what should be insect in ("Scripting.FileSystemObject")?
and what should be insect in (Server.MapPath("") & "/learn.txt") ?

View Replies


ADVERTISEMENT

Response.Write Server.MapPath(".") & Reading From Text File

I found the complete physical path to the doman by Response.Write Server.MapPath(".") and the path is: C:Inetpubwwwrootmyweb"&"gg.txt

With this,there's still error to read my text file.The error source code is place at below,please help me do correction!!! Code:

View Replies View Related

Writing Text File And Server.mappath

I have an application which was successfully writing data from submitted forms to a text file in a directory - in this case:

/data/findata.txt

This was fine because the forms lived at the root level with this directory.

Since then I have added enabled the forms to be used on subdirectories :

/subdirectory/myform.asp

I've used the same code for server.mapparth("data") etc - but instead of locating the directory at the root of the server called "data" it looks to the current directory- doesn't find it and creates another! eek!

What I need is a way to say "right, it doesnt matter what level you are at at the moment, always look at the root level /data directory"...

This has to be fairly dynamic - on the development server here its got a different file structure than on the live server (ie, it lives another level down again on the physical drive)...

Anyone got a good idea on how to look back up?

I do have one way to test which level they are at - but I feel that its a bit 'weak' - I have an ID that tells me if they are working on the upper or lower levels (ie, anything other than 1 is a lower level) - whilst I realise I could use this in the test I'm not sure if its going to be 100% fool proof to base this criteria on this ID.

Therefore I was hoping for a better way using the server.mappath etc...

View Replies View Related

Reading Text File From Ftp Server

I need to read a simple txt file where there are some variables. I've done
this a lot of times but in this case I have something different: the text
file is located at an ftp server.

The FTP server has anynomous access.

Anyone know how can I do this?

View Replies View Related

Delete File - Server.MapPath Problem

What's wrong with this code? Thie file is there, why cant it find it?

<%
myfile = request.querystring("filename")
response write myfile
myFSO.DeleteFile(Server.MapPath(" & myfile & "))
SET myFSO = NOTHING
%>

OUTPUT:
data/000000/index.htm

Microsoft VBScript runtime error '800a0035'

File not found

/deletefile.asp, line 9

View Replies View Related

Reading A TEXT File Without DB

I would like to know how I could accomplish this without using DB. There's a long text file named "TEST.TXT" The TEST file contains special character 'º' which will be used as pagebreak. I want an ASP page that will read the TEST.TXT file and split it into multiple web pages with navigation control. (eg. <FIRST<PREVIOUS>
<NEXT<LAST)

If it is possible

View Replies View Related

Reading Text File

I have a form that updates a text file. This text file writes variables (i.e. username = tom). This file is used to preview an HTML page and when you go to the form the variables are populated into the form fields again.

For some reason when someone else modifies the text file (using the form) I only see the old contents in the form fields. When I look at the preview HTML file, however, everything is fine.Why doesn't the form re-populate with the new info?

View Replies View Related

Text File Reading

i have a variable 'user', and a text file 'users.txt'. how can i search the text file and select the line thats the same as the variable 'user', then put that line into a variable?

'user' = 'root'

'users.txt' =

testuser1|kfkfjd
root|18273
test2|fjfkds

View Replies View Related

Reading A Text File

I need to create something that will read a text file and send e-mail statements from that text file. I know this is a basic application, but I am not sure where to start with this. The text file already contains all of the information for the statements. It is one file that starts with the customer e-mail address and then separates each statement by an <eob> marker. I need to be able to browse to upload the file and then have the application cycle through and generate all of the e-mails. I don't need to do any formatting to the text file, just read it and send the e-mails. The server currently uses CDOSYS to send other e-mails from a shopping cart application.

View Replies View Related

Reading From Text File

I have some messages in a text file.I would like to read one message every day from the text file. My Text file looks something like this

If you take medication for your blood pressure, you may need to be wary of adding certain pain relievers to your system. A class of pain-relieving anti-inflammatory medication often used to treat arthritis may interfere with a common blood pressure medication, according to research. The hash is just for demarcation. As I havent worked much with FileSystem can anyone help me how to go about acheiving the same.

View Replies View Related

Reading A Content Of Text File

I get a CD from O2 containing call data.I want to read the txt file on the CD and use the content of the textfile in an asp file to import to the database.But how do i read the file?

View Replies View Related

Problem With Writing/reading Text File

Here is what I have setup:

- a form that updates a text file.
- for example, in the form I have two fields, title and story. then, this write to a textfile (i.e. theinfo.asp). the update.asp file looks like this:

TSO.write "<%" & vbCrLf
TSO.write "title = """
TSO.write Request.Form("title")
TSO.write """" & vbCrLf
TSO.write "story = """
TSO.write Request.Form("story")
TSO.write """" & vbCrLf

- so, essentially it is creating an asp file with two variables.
- this works fine, it updates the file and i can call these variables in other pages. however, when i call these variables into a form : old versions of the variables populate the form: Code:

View Replies View Related

Reading And Writing Text File Using Vbscript

i had a vbscript that will read the text file from the bottom to the top, and after reading the file, it will be displayed in the screen, and the code look like this:
PHP Code: Code:

View Replies View Related

Site Search: Reading Text File ERROR

I have to make a site search function for my website. User types a keyword, and the search function searches through all the static pages for the keyword. The result of the search has to display the URL relating to the keyword, which the user can click to read the contents.

I had no idea how to go about doing it, finally I thought of using a textfile containing the word, and its related URL in the format: Code:

View Replies View Related

Reading File From Server

Consider the following code snippet:

<%
Dim objFSO,objOpenFile,strPath

strPath=Server.MapPath("ADList1.txt")
Set objFSO=Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
Set objOpenFile=objFSO.OpenTextFile(strPath,1)
Do While Not objOpenFile.AtEndOfStream
Response.Write(objOpenFile.ReadLine() & "<br>")
Loop
objOpenFile.Close
Set objOpenFile=Nothing
Set objFSO=Nothing
%>

When I try to execute the above code, the code never gets executed. Neither
am I shown a script timeout error. After a lot of investigations, I
concluded that the code is not getting executed due to the presence of

Set objOpenFile=objFSO.OpenTextFile(strPath,1)

If I comment line nos. 3 to 8, then the code gets executed but as expected
without any output. Is this happening because of some permission which has
not been given to IIS 5.0? If so, what is it? I am working on Windows 2000
Professional.

View Replies View Related

Reading File From A Server

I understand i can not use Scripting.FileSystemObject to read a file that resident on another server and i need to use something else.

View Replies View Related

Reading File From A Server

i understand i can not use Scripting.FileSystemObject to read a file
that resident on another server and i need to use something else.

View Replies View Related

Server.Mappath() To Include Files For Other Domains On Same Server?

If I have multiple websites on the same server,can I use the #include directive to reference include files elsewhere on the server? I tried this -

<!--#include file="C:InetpubvhostsATRAMEMBER.COMhttpdocsheader.asp" -->

But no dice...

View Replies View Related

HOWTO: Server.MapPath To A Different Server Computer

How do you use server.mappath to update a access database on a completely different computer? One of my websites needs to update a database on a completely different website. Code:

View Replies View Related

Load Text File From A Remote Server?

Is there a way to load a text file from a remote server into a string much like using the Inet Control in VB? I am familiar with reading in RSS feeds, but what should I do if the content is a straight text file?

View Replies View Related

Edit And Save A Text File On The Server

how to creat a page that will allow the user to edit and save a text file on the server.

View Replies View Related

Server.MapPath

Set objFile = objFSO.GetFile(Server.MapPath(strFileName))

this line brings up this error:
----------
Error Type:
Microsoft VBScript runtime (0x800A0035)
File not found
/Turbomaster/presupuesto_confirm.asp, line 67
------------
the variable strFileName is being read correctly..

View Replies View Related

Server.MapPath

there is an image folder in my root directoty containing images. When I run the following code from a file located in root directory, the file gets deleted. But when I put the file in some other folder, it generates error FILE NOT FOUND.

aND YES, i'VE TRIED BOTH
fso.deletefile(server.mappath("Images/"&photo))
fso.deletefile(server.mappath("/Images/"&photo))

<%
dim fso
photo="902392.jpg"
set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.deletefile(server.mappath("Images/"&photo))
%>

View Replies View Related

Server.MapPath() On IIS 6.0

I am running exactly the same ASP code on IIS 5.0 and IIS 6.0

I am calling Server.MapPath(), the parameter is a virtual path that includes a reference to a parent path ("Root/Files/../Config/"). 'Config' is a virtual directory under 'Root' which is also a virtual directory. 'Files' is a normal folder.

Under IIS 5.0, the path is correctly mapped to the local path of the 'Config' virtual directory.
Under IIS 6.0, the path gets mapped to "C:WebSiteRootFiles..Config", ignoring the 'Config' virtual directory mapping. Is there a special setting I should be aware of in IIS 6.0 to ensure correct
mapping of virtual paths?

View Replies View Related

Server.mappath.

I just don't understand it and I know I must be over complicating things.

strCon= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("diary.mdb")

but then I create a new folder called for instance 'database' and move my diary.mdb into it(with full permissions), what do I change the server.mappath to?

View Replies View Related

Server.mappath

My web site has three folders:

htdocs
logs
private

I want to access an MS Access database in the 'private' directory from scripts within the 'htdocs' folder.

Part of my connection string reads:

Data Source=" & Server.MapPath("../private/test.mdb")

But the page returns the following error:

Could not find file '[my web site]htdocsest.mdb'

Why is it still looking in the 'htdocs' folder when my connection string points to the 'private folder?

View Replies View Related

Server.MapPath

The Windows OS allows commas in file/folder names but if you try to call .Code:

Server.MapPath("/smith, john/")

your application will neatly halt and provide you with an error report.Other than telling your site/network users not to use commas as allowed in the OS what can the application designer do to avoid the error.I am sure a kludgey workaround is to scan for the comma, change the file/folder name to something safe then restore the name at the end. I don't think this is a safe way to do things though.

View Replies View Related

Server.MapPath

Code:

<%=Server.MapPath(rsCurrImgs("nvcLinkPath"))%>

Gives a strange error. When I do it like this: rsCurrImgs("nvcLinkPath")it works fine. What can it be?

Quote: Error Source: NULL
Category: Server.MapPath()
Description: Invalid Path Character

Full Description: An invalid character was specified in the Path parameter for the MapPath method.

View Replies View Related

Server.mappath

if you have an address

/dir/wwwroot/andy

and you use

server.mappath("/dir/andy")

you recieve the physical path , i.e. c:.inetpub/wwwroot/dir/andy

is there a way of going the other way ie from a physical path to a virtual path?

View Replies View Related

Server.mappath

I'm trying to create a log file of users accessing my site. This I can do on the current server using server.mappath, but I can't figure out how to write to a file on a different server.

View Replies View Related

Server.mappath

I'm trying to use the server.mappath function on a web site hosted on win
2000 professional.

Is this feature not on win 2000 pro?

It simply produces 'page not found' Code:

View Replies View Related

Need To Load File Path From Web Server Into Text Form Box

I need to load the file path of a file on a web server into a form text box. I tried using a normal form box using type=file but that just seems to return the file path from the local machine.

Ideally I'd like it if someone can get this to work with a file on a web server without using asp. If not then I suppose I'd have to use the FileSystemObject method. I can see how you can get a list of files from a remote server using FileSystemObject.

The problem I need help with is selecting a file path from the list of files into a text form box. The path of which I am then going to write to a database field.

View Replies View Related

Write Info On Form To Text File On Server

I want to write the info on a form to a text file. Code:

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved