How to Save text file from server to client PC

Results 1 to 5 of 5

Thread: How to Save text file from server to client PC

  1. #1
    Kelvin Guest

    Default How to Save text file from server to client PC

    Hi all,<BR>This is actually a repost quest as I have not receive any reply.<BR>My question is How do I save the text file from my server to the client PC.<BR>Which enable the user to save,rename and set the path where the user like to save the file.<BR>some sort like what we usually do to save picture through activating the save option when right click on the mouse.<BR> I have no idea how to solve this problem at all plz help.<BR><BR>Thank in advance<BR>

  2. #2

    Default RE: How to Save text file from server to client PC

    you asp page should spit out:<BR><BR>&#060;a href="myfile.txt"&#062;Myfile.txt&#060;/a&#062;<BR><BR>the user can right click on the mouse, and as with images, do save target as etc to save file on their machine

  3. #3
    kelvin Guest

    Default RE: How to Save text file from server to client PC

    Actually The problem is I don&#039;t want the user to right click the file and save as the picture but I like them to activated some sort of dialog box that the user will save the file as they like.<BR><BR>Thank

  4. #4
    a Guest

    Default RE: How to Save text file from server to client PC

    Here is a script that I have found. If it works or not I don&#039;t know, I havent had time to look at it yet... but It should do what you wanted...<BR><BR><BR><BR>&#039;&#039;&#039;&#039;& #039;Beginning of asp&#039;&#039;&#039;&#039;&#039;&#039;<BR>Respons e.Buffer = True<BR>Const rcWriteToBrowser = 0<BR>Const rcDownloadToBrowser = 1<BR>Const rcSaveToFile = 3<BR>Const ForAppending = 8<BR><BR>Class CResponse<BR> Dim rcWriteMode, strFileName, strHTML<BR><BR>&#039; The FileName Property<BR> Public Property Let FileName(fn)<BR> strFileName = CStr(fn)<BR> End Property<BR> Public Property Get FileName<BR> FileName = strFileName<BR> End Property<BR><BR>&#039; The WriteMode Property<BR> Public Property Let WriteMode(wm)<BR> rcWriteMode = Cint(wm)<BR> End Property<BR> Public Property Get WriteMode<BR> WriteMode = rcWriteMode<BR> End Property<BR><BR> Private Sub Class_Initialize()<BR> strHTML = ""<BR> End Sub<BR><BR> Private Sub Class_Terminate()<BR> Select Case rcWriteMode<BR> Case rcDownloadToBrowser<BR> Response.ContentType = "unknown/exe"<BR> Response.AddHeader "Content-Disposition","attachment;filename=" _<BR> & Right(strFileName, Len(strFileName) - InStrRev(strFileName, "\"))<BR> Response.Write strHTML<BR> &#039;Response.Write strFileName<BR> End Select<BR> End Sub<BR><BR>&#039; The Write Method:<BR> Public Function Write(strInput)<BR> Select Case rcWriteMode<BR> Case rcWriteToBrowser<BR> Response.Write(strInput)<BR> Case rcDownloadToBrowser<BR> &#039; Collect HTML to use later:<BR> strHTML = strHTML & strInput<BR> Case rcSaveToFile<BR> Response.Write(strInput)<BR> Dim objFSO, objTS<BR> Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR> Set objTS = objFSO.OpenTextFile(strFileName, ForAppending, True)<BR> objTS.WriteLine strInput<BR> objTS.Close<BR> Set objTS = Nothing<BR> Set objFSO = Nothing<BR> End Select<BR> End Function<BR>End Class<BR>&#039;&#039;&#039;&#039;end of asp&#039;&#039;&#039;&#039;&#039;

  5. #5
    Sven CIpido Guest

    Default RE: How to Save text file from server to client PC

    Hi,<BR><BR>I had the same problem. I also have used the Filesystemobject. It works fine, but has the only problem that it only saves files on the webserver itselfs. So the users can&#039;t get anymore to the textfile. The solution I has used is :<BR><BR>I have created an ActiveX, which will show the Windowsdialogbox to select a directory and give a filename on the clientPC and the network. Then a routine will save for me the textfile on the given lovation.<BR><BR>If you want an example, please contact me at<BR><BR>Kind Regards<BR>Sven Cipido

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts