# Change file name before uploading

**URL:** <https://forum.kirupa.com/t/change-file-name-before-uploading/281296>\
**Category:** Uncategorized\
**Created:** [February 7, 2009, 12:07am UTC](https://forum.kirupa.com/t/change-file-name-before-uploading/281296 "2009-02-07T00:07:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samurai](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@Samurai](https://forum.kirupa.com/u/Samurai)\
**Post date:** [February 7, 2009, 12:07am UTC](https://forum.kirupa.com/t/change-file-name-before-uploading/281296/1 "2009-02-07T00:07:10Z")

</div>

Hey I’ve been trying to get this to work for a while but have failed. This is a 2 part question.

part 1:

I am using the file reference tutorial to upload an image to the server

[http://www.kirupa.com/developer/flash8/uploading\_fileReference\_pg1.htm](http://www.kirupa.com/developer/flash8/uploading_fileReference_pg1.htm)

obviously it works great. but I want to make each file upload unique, so if I upload mypicture.jpg to the server, I want to change the name of the file to mypicture1039094.jpg (or something that is unique).

part 2:

I want to also capture that new random file (mypicture1039094.jpg) in a text field so I can send it to a php script.

any and all help would be very appreciated.

Thanks.
