473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to Write Text File to Web Server

Greetings, I need a simple method using ActiveXobject in javascript to write a text file from the local drive to my webserver. I found a method on a previous thread that copies a file from the webserver to the local drive that works but I need to reverse this. The code I found previously on the posting from "drink.the.coolaid" is as follows.
________________________________
Create a text file called c:\GetWebPage.js:

Expand|Select|Wrap|Line Numbers
  1. var fso = new ActiveXObject('Scripting.FileSystemObject');
  2. var args = WScript.Arguments;
  3. var url = args(0);
  4. var fileName = args(1);
  5. var xmlhttp=new ActiveXObject("microsoft.xmlhttp");
  6. xmlhttp.open("GET", url, false);
  7. xmlhttp.send();
  8. var data=xmlhttp.responsetext;
  9. var file = fso.CreateTextFile(fileName, 2);
  10. file.writeLine(data);
  11. file.close();
  12.  
>From a command line type:
cscript /nologo c:\GetWebPage.js http://www.YOUR_URL_HERE.com c:
\YOUR_OUTPUT_FILE_HERE.txt
_____________________________________

Is there a way to reverse this code to copy the file from the local to the webserver instead?
Sep 17 '10 #1
3 3188
gits
5,390 Expert Mod 4TB
what exactly do you want to do? is the file already at the client or is it created uring a session and you just want to save the data at the server?
Sep 21 '10 #2
The text file is created on the javascript client-side and I would like to copy it to the webserver using a similar method to the sample that I posted. I have tested that script and it works with some modification but I need to reverse the copy method from the local file to the web server wwwroot or a subfolder instead.
Sep 21 '10 #3
gits
5,390 Expert Mod 4TB
in case the textfile is created clientside you just need to send the data with a request to the server and write it to a file ... you might use a simple AJAX-call for that purpose ... or is that your question?
Sep 21 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Google Mike | last post by:
I have PHP version 4.2.2 that ships with RH9. I want to have it write to a file like this: function WriteLog($sLogFile, $sMsg) { if (substr($sLogFile,1,1) != '/') { $sLogFile =...
1
by: Gurk | last post by:
hallow all i'm using a common dialog to save data into a text file. for so far i have this, but can someone give me a simpe exaple what i have to do after the line Open cdl.FileName For Output...
6
by: Kevin Ingram | last post by:
Ok, this is probably a silly question but I just keep hitting a brick wall here. I usually develop my sites entirely in ASP and use a database for data storage, works great for me. I also...
2
by: Tom Youngquist | last post by:
I am trying to download a text file that my .NET page has just created based on entered parameters on the web page. Everything seems to work and the file is created. I am using the following code...
1
by: WebSim via .NET 247 | last post by:
Hi, I want to read a text file, and then write it into dataset. Is it possible? or Is there any solution that read text file into DB? ----------------------- Posted by a user from .NET 247...
2
by: sympatico | last post by:
hi, pls help me slove this problem. i am a newbie in using asp.net and SQL server 2000 and my problem for now is to pass data to a textfile and i have fail to do so. the way i did it was i used...
4
by: Andyza | last post by:
I'm using FileSystemObject to open and write to a tab delimited text file. First, I connect to a database and select some data. Then I create the text file and insert each record in the text...
1
by: cwl | last post by:
I want to get the content of a webpage containing plain text and write the content to a text file. My code looks like this: Set xmlhttp = CreateObject("Microsoft.XMLHTTP")...
3
by: mainul | last post by:
Hi guys i can write text file and also can read it. below are the codes. <?PHP //write to a file $body_content="This is my content"; // Store some text to enter inside the file...
1
by: lokeshrajoria | last post by:
hello, how can i write text file text data to binary data in binary file. Thanks & Regards Lokiii
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.