469,572 Members | 1,306 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

To create a text file in local macine from website..

( all in my websites) I am opening a database (stored in ftp -- ms access database) ..
after retrieving i want to write to a file in local machine... (something .. c:\test.txt)

its work fine while i am running in local host.. but in net .. its showing error...

i want to know if i want to create a file.. from website.. whether i have to provide any permission.. (security concern)

please answer
regards
ela
.

MY coding is....
Expand|Select|Wrap|Line Numbers
  1. <%
  2.  
  3.          Set fs = CreateObject("Scripting.FileSystemObject") 
  4.          Set wfile = fs.CreateTextFile("c:\myfile.txt", True) 
  5.  
  6.  ------------this database in ftp
  7.  
  8.      call opendatabase()
  9.            Set rsftp= con.Execute("select * from sendsms")
  10.            While not rsftp.Eof 
  11.               msg=rsftp.fields("col1")
  12.               sender=rsftp.fields("col2")
  13.  
  14.            'wfile.Write (msg)
  15.            'wfile.Write (sender)
  16.                   rsftp.movenext
  17.            wend
  18.  
  19.    Conloc.Close()
  20.    call closedatabase() 
  21.  
  22.  
  23. %>
Oct 22 '07 #1
2 1760
JamieHowarth0
533 Expert 512MB
Hi Elavarsi,

You need to create a text file that will be held in session and then use a download stream to stream the text file to the browser, as your current code is set to try and save the text file to your web server's C: drive which will be completely blocked as standard.

This article explains how to use the following code to force the web browser to download a file:

Expand|Select|Wrap|Line Numbers
  1. Response.AddHeader("content-disposition:attachment;filename=temp.txt")
  2.  
The browser will recognise it as an attachment and prompt the user to save the file to their hard disk. For security purposes there is no way of automatically saving a file using ASP to a user's hard disk, otherwise very malicious individuals could use it to automatically download viruses to your PC.

Best regards,

medicineworker
Oct 22 '07 #2
clain
79
in no way you can save a text file from wesite....

if that was possible then .... ooops what will be the securty for your pc?
Oct 25 '07 #3

Post your reply

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

Similar topics

1 post views Thread by Mark | last post: by
3 posts views Thread by DBLWizard | last post: by
16 posts views Thread by Mich | last post: by
5 posts views Thread by =?Utf-8?B?TGVvbg==?= | last post: by
2 posts views Thread by John_Doe | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.