Menu
Hello,
is it possible to write a file on the client side with JavaScript ?
Jean-Marie
Function saveThis(fileSpec)
isData = xferContent.innerHTML
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(fileSpec) Then
MsgBox "Test.txt already exists...", vbInformation, "Information"
Exit Function
End If
Set contentFile = fso.CreateTextFile(fileSpec,True)
contentFile.WriteLine(isData)
contentFile.Close
MsgBox "Successfully saved to Test.txt", vbInformation, "Information"
set fso = Nothing
End Function
Function appendThis(fileSpec)
isData = appendContent.innerHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set contentFile = fso.GetFile(fileSpec)
Set fsoStream = contentFile.OpenAsTextStream(8)
fsoStream.WriteLine(isData)
fsoStream.Close
MsgBox "Successfully appended to Test.txt", vbInformation, "Information"
Set fsoStream = Nothing
Set fso = Nothing
End Function
Function readThis(fileSpec)
Set fso = CreateObject("Scripting.FileSystemObject")
Set contentFile = fso.GetFile(fileSpec)
Set fsoStream = contentFile.OpenAsTextStream(1)
isData = fsoStream.ReadAll
readContent.innerHTML = isData
fsoStream.Close
Set fsoStream = Nothing
Set fso = Nothing
End Function
Function showInfo(fileSpec)
Set fso = CreateObject("Scripting.FileSystemObject")
Set contentFile = fso.GetFile(fileSpec)
strInfo = contentFile.Name & vbCrLf
strInfo = strInfo & "Created: "
strInfo = strInfo & contentFile.DateCreated & vbCrLf
strInfo = strInfo & "Last Accessed: "
strInfo = strInfo & contentFile.DateLastAccessed & vbCrLf
strInfo = strInfo & "Last Modified: "
strInfo = strInfo & contentFile.DateLastModified
MsgBox strInfo, vbInformation, "File Information"
Set contentFile = Nothing
Set fso = Nothing
End Function
Thanks Warren,
that exactly what I want to do. I copy your script, but it did not work : the function are unkown.[/QUOTE]
<i>
</i>Set fso = CreateObject("Scripting.FileSystemObject")
<i>
</i>fso = new ActiveXObject("Scripting.FileSystemObject");
I use Firefox. I did not want to use ActiveXControl, so what can you suggest me to solve my problem ?[/QUOTE]
... are you coding malware, per chance?[/QUOTE]
There are valid and legitimate reasons for wanting to write to the visitors harddrive[/QUOTE]
attempting to write to the users' HDDs suggests nefarious activity. sending attachments is not writing to the user's disk.[/QUOTE]
I disagree with both of your statements -- and, ya know, I am allowed to do that. [/QUOTE]
Attempting to write directly to the visitor's harddrive suggests only a lack of knowledge about the restrictions concerning same. [/QUOTE]
Also, since sending an attachment normally and usually results in a file getting written to the visitor's harddrive, any distinctions you attempt to bring to bear are merely splitting hairs.[/QUOTE]
0.1.9 — BETA 6.1