You can find a lot of resources on that. Here's a topic on getting the file extension: http://stackoverflow.com/questions/190852/how-can-i-get-file-extensions-with-javascript
Once you have the extension, you can put in whatever you want before it. On Jul 20, 1:56 pm, "Dave Maharaj :: WidePixels.com" <d...@widepixels.com> wrote: > Before could be anything the user has 07.jpg to > this_is_my_best_friends_wedding.jpg and I just want to completely remove > everything before the extension and replace it with something unique like > date/time so 12565895.jpg > > -----Original Message----- > From: James [mailto:james.gp....@gmail.com] > Sent: July-20-09 9:21 PM > To: jQuery (English) > Subject: [jQuery] Re: Rename a file name > > Could you give an example of a 'before' and 'after' of a filename? > > On Jul 20, 1:43 pm, "Dave Maharaj :: WidePixels.com" > <d...@widepixels.com> wrote: > > I was wondering if someone could point out how to rename a file name. > > > In the script I am using I see > > > function fileFromPath(file){ > > return file.replace(/.*(\/|\\)/, ""); > > > } > > > which replaces characters.... but how would I completely rename the > > file > > > I tried: > > > function fileFromPath(file){ > > > var dateObject = new Date(); > > var file = > > dateObject.getFullYear() + '' + > > dateObject.getMonth() + '' + > > dateObject.getDate() + '' + > > dateObject.getTime(); > > > return file(""); > > > //return file.replace(/.*(\/|\\)/, ""); > > > } but i lose the extension of the file > > > Dave > >