Page 1 of 1

how to rename file at run time

Posted: Thu Aug 02, 2007 1:12 am
by eshban
i have a php form , in which i have some controls. On a form there is a "File Field" control. When user select any file from browse button, the file will be uploaded successfully.

But i need some modifications.

I want that when user upload a new file, the php code rename the file and add some random string with the file name.

How can i do this, i spend many time on this module, but i am unable to do it.

Please help in this regard.
Thanks

Posted: Thu Aug 02, 2007 2:38 am
by Christopher

Posted: Thu Aug 02, 2007 3:23 am
by Gente
What are you using for upload?
move_uploaded_file() ?
This way I don't understant what is the problem to change the second parameter.

Posted: Thu Aug 02, 2007 3:53 am
by eshban
i use "COPY" command to upload files

Posted: Thu Aug 02, 2007 3:58 am
by Gente
The same situation. Specify the destination name in the 2nd parameter of copy().

Posted: Sat Aug 04, 2007 8:38 am
by feyd
copy() is not intended for use with uploads. Use move_uploaded_file().