Forum Moderators: open

Message Too Old, No Replies

Create a file on javascript execution

Is it possible and how?

         

jp_css

4:08 pm on Mar 8, 2004 (gmt 0)

10+ Year Member



Is it possible to create a file using javascript? How would I do this, if possible?

isitreal

5:10 pm on Mar 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No, Javascript isn't allowed to create files as far as I know.

DrDoc

6:05 pm on Mar 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What do you mean by "creating a file"? Create a file on the server, or for download by the user... or what?

jp_css

7:19 pm on Mar 8, 2004 (gmt 0)

10+ Year Member



I would like to create a file on the server. I have some javascript code (that I didn't write) that generates output, but I would like to store this elsewhere in a file (it generates a string so that wouldn't be too hard to store). Or, as an alternative, if I could transfer a large amount of information from javascript to php (I have messed around a lot with this, but can't get it to do it right), that would work too.

PatomaS

8:34 pm on Mar 8, 2004 (gmt 0)

10+ Year Member



Well if you are using php, all the answers to your problem would be found in it and not in JavaScript

:)

jp_css

9:32 pm on Mar 8, 2004 (gmt 0)

10+ Year Member



Yeah, but the key is that I don't know a good way to pass a large variable from javascript to php. After that is done, I would store the value in a mySQL database.

figment88

9:36 pm on Mar 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you can use a webbug to transfer information from javascript to php.

this forum has some samples in another context
[webmasterworld.com...]

jp_css

10:01 pm on Mar 8, 2004 (gmt 0)

10+ Year Member



Yeah, I've tried do the little webbug thing. I was having problems passing a large variable, but I can try again. Any suggestions?

figment88

10:18 pm on Mar 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



not really sure how large is large - I guess you could run into problems with the length of the query string.

Possible options:
1) use multiple webbugs
2) create a form with a post method in an invisable iFrame. Force a form submit with JavaScript