# Create txt file from Falsh

**URL:** <https://forum.kirupa.com/t/create-txt-file-from-falsh/12851>\
**Category:** flash\
**Created:** [February 5, 2003, 10:07am UTC](https://forum.kirupa.com/t/create-txt-file-from-falsh/12851 "2003-02-05T10:07:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![discoverme](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@discoverme](https://forum.kirupa.com/u/discoverme)\
**Post date:** [February 5, 2003, 10:07am UTC](https://forum.kirupa.com/t/create-txt-file-from-falsh/12851/1 "2003-02-05T10:07:59Z")

</div>

Can we create a txt file from the data inputs in flash.

I am using some variables in swf called form an external txt file. Can we by any chance call the variable values…update the vlaues… in flash and save them in that particular txt file (overwritte the exisiting one)

Please let me know if we can.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 4:06pm UTC](https://forum.kirupa.com/t/create-txt-file-from-falsh/12851/2 "2003-02-05T16:06:40Z")

</div>

You can’t do it with Flash alone. You need to use PHP or ASP.

[http://www.kirupaforum.com/showthread.php?s=&threadid=10150&highlight=PHP+write+to+text+file](http://www.kirupaforum.com/showthread.php?s=&threadid=10150&highlight=PHP+write+to+text+file)

[http://www.kirupaforum.com/showthread.php?s=&threadid=12463&highlight=PHP+guestbook](http://www.kirupaforum.com/showthread.php?s=&threadid=12463&highlight=PHP+guestbook)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 6:59pm UTC](https://forum.kirupa.com/t/create-txt-file-from-falsh/12851/3 "2003-02-05T18:59:24Z")

</div>

> \*Originally posted by Jubba \*  
> \*\*You can’t do it with Flash alone. You need to use PHP or ASP.

[http://www.kirupaforum.com/showthread.php?s=&threadid=10150&highlight=PHP+write+to+text+file](http://www.kirupaforum.com/showthread.php?s=&threadid=10150&highlight=PHP+write+to+text+file)\*\*

Well the url quoted wouldn’t help discoverme, Jubba. ☹  
It would look different this way actually, it’s like updating the textfile content instead of adding.

Here is a php script that would help you, if you can’t arrange the flash part, let me know.

```php
<?
$datafile = "textfile.txt";
$data = "&variable1=" . $_POST['variable1'];//variable1 is from flash
$data .= "&variable2=" . $_POST['variable2'];//variable2 is from flash
$file = @fopen($datafile, 'w');
if (!$file) {
    print "&result=error";
    exit;
}
fwrite($file, $data);
fclose($file);
print "&result=success";
?>

```

The idea of this code is neither adding nor updating, it is simply rewriting the textfile with the specified values given from flash! Well I think it does what you need, discoverme.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 7:01pm UTC](https://forum.kirupa.com/t/create-txt-file-from-falsh/12851/4 "2003-02-05T19:01:34Z")

</div>

I didn’t really read the post lol. I just saw Flash and writing to a text file so I posted all the files that I knew were on the forum that had to do with Text files and PHP.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 4:25am UTC](https://forum.kirupa.com/t/create-txt-file-from-falsh/12851/5 "2003-02-06T04:25:05Z")

</div>

Thanks a lot…i will just try it in flash.

Will it creat txt file in the format i want…example

text file should contain 4-5 variable values. So it should be like…

scroll0=23&scroll1=35&scroll2=42&scroll3=54

if you have an example ready in fla format please do send it to me. Thanks a million.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 4:45am UTC](https://forum.kirupa.com/t/create-txt-file-from-falsh/12851/6 "2003-02-06T04:45:18Z")

</div>

In order to create or edit a text file you need to use PHP or ASP. it is impossible to do with Flash alone.
