Reply LinkBack Thread Tools Search this Thread
Old 16-01-2006, 15:30   #1 (permalink)
needHelpOnASP
Registered User
 
Join Date: Jan 2006
Posts: 4
Trying to create a file on client-side!

Hi There,

I am using vbscript. I needed to create a file on the client-side from server-side, but I realized it is not possible. One way might be using ActiveX, but I have no idea where to begin with. Can anyone help me get started on it or have a better suggestion on approaching this problem?

Thanks very much,
Armon
  Reply With Quote
Old 16-01-2006, 16:40   #2 (permalink)
cam
vague™
 
cam's Avatar
 
Join Date: Mar 2004
Location: Glasgow
Posts: 5,513
What are you trying to do that you need to create a file on the client-side?

Surely there's nothing preventing you creating it server-side and then presenting the user with a download dialogue/screen?
  Reply With Quote
Old 16-01-2006, 16:54   #3 (permalink)
needHelpOnASP
Registered User
 
Join Date: Jan 2006
Posts: 4
That will do too, but how may I do it?

Thank you
  Reply With Quote
Old 16-01-2006, 17:10   #4 (permalink)
cam
vague™
 
cam's Avatar
 
Join Date: Mar 2004
Location: Glasgow
Posts: 5,513
For a start you haven't told us what kind of file you wish to generate, nor any other useful information.

I'm/We're not here to do other people's jobs. At least make an effort to look like you've done some research on the subject before asking for help.
  Reply With Quote
Old 16-01-2006, 17:28   #5 (permalink)
needHelpOnASP
Registered User
 
Join Date: Jan 2006
Posts: 4
I'm sorry if I did not provide you with enough information. Using vbscript, I need to create a simple text file on the sever-side and have it downloded to the local machine of the client. Now, I did create my text file with:

Set FS = Server.CreateObject("Scripting.FileSystemObject")
Set myFile = FS.CreateTextFile("C:\testfile.txt", True)

But, the part I need a hint on is how to download it to the client side. By the way, this is within a local network, if helps.

Thanks
  Reply With Quote
Old 17-01-2006, 06:14   #6 (permalink)
MikeMackay
Everything is fine.
 
MikeMackay's Avatar
 
Join Date: Feb 2005
Location: Witham & London
Posts: 828
Send a message via MSN to MikeMackay Send a message via Skype™ to MikeMackay
Search Google for:

Content-Type
Content-Disposition

That should get you going in the right direction.

- Mike
  Reply With Quote
Old 17-01-2006, 06:26   #7 (permalink)
stealthcow
knocking heads
 
stealthcow's Avatar
 
Join Date: Jul 2003
Location: London, UK
Posts: 1,914
hooray for spyware and virii
  Reply With Quote
Old 17-01-2006, 08:41   #8 (permalink)
Transmogrify
Rough Creep Arse™
 
Transmogrify's Avatar
 
Join Date: Jul 2005
Location: Vancouver, Canada
Posts: 1,888
Send a message via MSN to Transmogrify
Can you not create the file you need the user to download and then offer it as a link? Otherwise, like mike suggested content-type - which will rewrite the http headers and prompt the user to download. Note you can't force the user to download a file (except perhaps with the epitome of security "activex").
  Reply With Quote
Old 18-01-2006, 13:57   #9 (permalink)
needHelpOnASP
Registered User
 
Join Date: Jan 2006
Posts: 4
Thanks for your help guys. I am on the Roll now!
  Reply With Quote
Old 18-01-2006, 14:27   #10 (permalink)
paulanthony
mingin dawg baitch
 
paulanthony's Avatar
 
Join Date: Apr 2004
Location: Belfast
Posts: 1,035
Send a message via MSN to paulanthony
Response.Redirect("testfile.txt")

or....

Code:
<%Response.buffer=True '/////////////////////////////////////// '// Not tested. fuck with this yourself '/////////////////////////////////////// Response.ContentType = "application/asp-unknown" Response.AddHeader "content-disposition","attachment; filename=" & Server.Mappath("c:\testfile.txt") Set FStream = Server.CreateObject("ADODB.Stream") FStream.Open() FStream.Type = 1 FStream.LoadFromFile(Server.Mappath("c:\testfile.txt")) Response.BinaryWrite FStream.Read() FStream.Close Set FStream = Nothing Response.End '//////////////////////////////////////// %>
__________________
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8