I'm working on the file frmupload.html, I don't know if it's the right file to do this.
What I want to do, is to remove any invalid character on filenames when I upload files on the server using the default file handler that comes with FCKEditor.
I want to remove things like : !@#$%&*(àéçÉÀÇ, etc. All I want to keep is letters, numbers, underscores dans dash, and I want to replace blank spaces with dashes.
so, if a file is named Good morning! héhé&go_-.gif, it would be renamed to Good-morning-hhgo_-.gif
no invalid chars, no spaces, just '_' and '-' and letters and numbers
So I wrote this;
This code works alone, try this snippet on a HTML file;
but I can't seem to find where to place it on the frmupload.html file, someone knows it? Or if it's not on that file, someone knows which one I have to call and where to place it?
Thanks a lot.
What I want to do, is to remove any invalid character on filenames when I upload files on the server using the default file handler that comes with FCKEditor.
I want to remove things like : !@#$%&*(àéçÉÀÇ, etc. All I want to keep is letters, numbers, underscores dans dash, and I want to replace blank spaces with dashes.
so, if a file is named Good morning! héhé&go_-.gif, it would be renamed to Good-morning-hhgo_-.gif
no invalid chars, no spaces, just '_' and '-' and letters and numbers
So I wrote this;
NewFile = NewFile.replace(/[^a-zA-Z 0-9_.-]+/g,''); NewFile = NewFile.replace(/ /g, '-');
This code works alone, try this snippet on a HTML file;
<script type="text/javascript"> var str="Good morning! héhé&go_-.gif"; str = str.replace(/[^a-zA-Z 0-9_.-]+/g,''); str = str.replace(/ /g, '-'); document.write(str); </script>
but I can't seem to find where to place it on the frmupload.html file, someone knows it? Or if it's not on that file, someone knows which one I have to call and where to place it?
Thanks a lot.