Filename: Replace spaces with underscores

Greetings,
I have searched the forum and online and have not found an
answer.
So posting here for assistance.
What is the proper syntax for replacing spaces in file names
with under
scores prior to cffile upload? -or- what is the best method
to accomplish
this process?
Example:
document name.doc >> document_name.doc
Thanks
Leonard

you can't change the filename before the file has been
uploaded to your
server.
upload a file using cffile.
#cffile.serverfile# variable will contain the name with which
the file
has been saved on your server.
check if the name contains any spaces using find() cf
function.
if it does, use cffile action="copy" to copy the file as a
file with no
spaces in the name (use replace() cf function to replace
spaces with
whatever you want).
[you may want to make sure prior to copying the file that
there is not
already a file with same name (with no spaces) in that
folder, otherwise
the copy action will overwrite existing file]
delete original file.
details of all the functions are in the CFML Reference. if
you do not
have one - download free from adobe.com
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Similar Messages

  • Layers to files: replace spaces with underscores

    How can I update the script to replace spaces with underscores on export? I assume I need to add a line somehwere between 183-195 but I don't know what it needs to be. Thanks in advance.

    Where did you get the Layers to files script. Photoshop versions ship with a "Export Layers To Files.jsx" CS6 lines 183-195 look like this I see nothing about filename
      var layerSetsCount = app.documents[docName].layerSets.length;
             if ((layerCount <= 1)&&(layerSetsCount <= 0)) {
                if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                    alert( strAlertNeedMultipleLayers );
                            return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
            } else {
                var rememberMaximize;
                var needMaximize = exportInfo.psdMaxComp ? QueryStateType.ALWAYS : QueryStateType.NEVER;
                if ( exportInfo.fileType == psdIndex && app.preferences.maximizeCompatibility != needMaximize ) {
                    rememberMaximize = app.preferences.maximizeCompatibility;

  • When generating layers it replaces spaces with underscores

    Hi All,
    I am working now with RH8, and when I am saving projects and give the name, let's say "my file.chm" it replaces the space with an underscore and the name becomes "my_file.chm". Is it possible to do anything about that?
    Thank you

    I think that what I said means you cannot generate with spaces.
    Bug? It has done it that way for several versions and I believe it is important if you are creating merged CHM help.
    Submit a bug request or feature change request according to your point of view.
    Please follow this link.
    http://www.Adobe.com/cfusion/mmform/index.cfm?name=wishform&product=38
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Replacing space with special char in reporting

    I have created a calculatd Keyfigure where if the consition given in the calculated KF satisfies then it displays 1 otherwise space ,now mu user wants space to be replaced by some special charcter
    Example
    My ckf is like this overallscore >= 90 & Iam applying count on this
    Vendor   CKF
    X              1
    Y
    Z                1
    As vendor y is not satsifying the condition its showing with space now I want to replace space with some special char how is this possible

    Hi Priya,
    You can try this: Instead of space, fill this with a 0. Then in the query properties, set the Show Zero As and give your special char, like may be *. But this will be okay if you do not have other zeros in the report...else you may need to do some VB coding.
    Hope this helps...

  • Replace spaces with a + sign

    Hi,
    In on of my columns I have a text... I want to replace spaces with a plus (+) sign... something linke this
    select
    text_field,
    Function_replace(text_field, " ", "+") new_field
    from
    table_A

    It's almost that:
    SQL> with table_a as (
      2  select 'abc dd   efg ' text_field from dual)
      3  -- end of sample data
      4  select text_field, replace(text_field, ' ', '+') new_field
      5    from table_a;
    TEXT_FIELD    NEW_FIELD
    abc dd   efg  abc+dd+++efg+
    SQL> edit:
    If you want to replace any number of consecutive spaces for a single + sign, then:
    SQL> with table_a as (
      2  select 'abc dd   efg    h' text_field from dual)
      3  -- end of sample data
      4  select text_field,
      5         regexp_replace(text_field, ' +', '+') new_field
      6    from table_a;
    TEXT_FIELD        NEW_FIELD
    abc dd   efg    h abc+dd+efg+h
    SQL> Edited by: fsitja on Mar 31, 2010 12:27 AM

  • Syncing hebrew notes with icloud distorts them by replacing spaces with exclamation marks. how do i fix this?

    syncing hebrew notes with icloud distorts them by replacing spaces with exclamation marks. how do i fix this?

    I'm syncing my iPhone 5 and my iCloud account. I open the account on my PC with a Google Chrome browser.
    iPhone:
    The same note on iCloud:
    So.. Any ideas?

  • Replacing spaces with dashes

    Photoshop CS4 is replacing spaces in the filenames with dashes. How do I make it stop doing that?

    in save for web? look at the options. probably set to unix file systems. you know that file names on the web (if that's your intended use) may not contain spaces, rigth?

  • [SOLVED] Find and replace quotes with underscores in file names

    I was looking to replace all of the quotes in file names in a directory with underscores.  I seem to be having a problem doing so, though.  Running the find command:
    find . -name '*[\`\'\"]*' -exec sh -c "mv -i '$0' '${0//[\`\'\"]/_}'" {} \;
    I get a > inviting me to continue the command.  What am I doing wrong?
    Last edited by gogi-goji (2010-01-03 02:19:13)

    @lolilolicon: yeah the -exec part does give another level of quotes, so you can run into trouble with scripts inside -exec.
    I didn't know you could give {} as an argument after sh -c and $0, that solves the problem of not knowing which quotes to use around it in the -exec part.
    $ find -mindepth 1 -exec sh -c 'mv -v --backup=t "$0" "$(echo "$0" | sed s/[\\x27\"\`]/___/g)"' {} \;
    mv: `./a b' and `./a b' are the same file
    `./\'' -> `./___'
    `./\'"\'' -> `./_________'
    mv: `./$0' and `./$0' are the same file
    mv: `./a' and `./a' are the same file
    mv: `./$(echo crash)' and `./$(echo crash)' are the same file
    `./"' -> `./___' (backup: `./___.~1~')
    `./\'\'\'' -> `./_________' (backup: `./_________.~1~')
    Or with the other substitution method, it doesn't interpret \x27 (you could use $(echo -e \\x27) or you have to use ...'\\\''...
    $ find -mindepth 1 -exec sh -c 'echo mv -v --backup=t "$0" "${0//['\\\''\"\`]/___}"' {} \;
    $ find -mindepth 1 -exec sh -c 'echo mv -v --backup=t "$0" "${0//[$(echo -e \\x27)\"\`]/___}"' {} \;
    mv -v --backup=t ./a b ./a b
    mv -v --backup=t ./' ./___
    mv -v --backup=t ./___ ./___
    mv -v --backup=t ./'"' ./_________
    mv -v --backup=t ./$0 ./$0
    mv -v --backup=t ./___.~1~ ./___.~1~
    mv -v --backup=t ./a ./a
    mv -v --backup=t ./$(echo crash) ./$(echo crash)
    mv -v --backup=t ./_________ ./_________
    mv -v --backup=t ./" ./___
    mv -v --backup=t ./''' ./_________
    mv -v --backup=t ./_________.~1~ ./_________.~1~

  • CLOB to BLOB replacing spaces with Â

    I have a CLOB that we are converting to a BLOB using DBMS_LOB.CONVERTTOBLOB and then serving it up as a file using WPG_DOCLOAD.DOWNLOAD_FILE. When you open the file, it is replacing the spaces with a Â.
    Any thoughts?

    Most likely, the spaces in the original CLOB were not regular spaces (0x20) but rather non-breaking spaces (0xA0).
    What's the target encoding used to convert to BLOB? I suppose UTF-8?
    UTF-8 encodes non-breaking spaces as 0xC2A0, where 0xC2 is specifically the codepoint for "Â". So I think the tool you're using doesn't support UTF-8, or doesn't recognize the file as being properly encoded.
    Edited by: odie_63 on 14 août 2012 14:26

  • Replacing space with some char in report display

    dear friends
    hw can i replacs space in report display with char .
    there is disply like
                     site 1    site2   site3
    matnr1           space      10        space
    matnr 2            2        space     space
    site in x -axis  ,matnr in -y-axis.
    i want to replace this space  by some char like nd or ns  etc
    can any one give solution....
    regards
    veera

    hi this my condtion .....
    if the first condtion satisfed i have to replace by ND
    which is now mentioning as space.if send condtion satisifed  having 10(na) in display
    loop at it_final1.
                        read table it_final2 into wa_final2 WITH KEY matnr = it_final1-matnr.
                               IT_RESULT-matnr = IT_final1-matnr.
                               IT_RESULT-WERKS = IT_final1-vstel.
                        if it_final1-LFimg = wa_final2-vsolm.
                             it_result-LFimg = 'nd'.
                            ELSEIF IT_FINAL1-LFIMG < WA_FINAL2-VSOLM.
                                 it_result-LFIMG = WA_FINAL2-VSOLM - IT_FINAL1-LFIMG.
                                 ELSEIF WA_FINAL2 IS NOT INITIAL.
                        IT_RESULT-lfimg = IT_final1-lfimg.
                        else.
                        IT_RESULT-lfimg = IT_final1-lfimg.
                                     ENDIF.
                        COLLECT it_result.
        ENDLOOP.

  • HELP : Replacing Space with any character !

    Hi !
    How do I replace any spaces in a strings passed from a FORM INPUT, with a different character.
    I tried doing this
    String s= request.getParameters("info");
    s.replace(' ','_');
    But it keep giving me error.
    it there any simpler way of doign this?
    Thank you
    K

    Hi !
    I am new to JSP,
    It keep giving a null pointer exception when i use it with JSP
    So i did this it work fine on the try section
    and once it is in the catch section it keeps giving me Nullpointer exceptions again.
    IS there any other way replacing the space with a "-" or anything..?
    Thanks for your help.
    here is the code
    String r_space ="";
    try {
         r_space=value.replace(' ','+');
         out.println("r_space : try " r_space "<br>");
    catch(NullPointerException e) {
    System.out.println("Recaught: " + e );
    r_space=value.replace(' ','+');
    out.println("r_space : cathc" r_space "<br>");

  • Help Needed - replacing space with non-breaking space on the fly

    Hi,
    I have a text field I'm trying to fiddle the input on. Basically I want to replace all spaces (ascii code 32) with non-breaking spaces (ascii code 160) as they are typed.
    It seemed as though a KeyListener was the way to go, and I've successfully detected whenever a space is sent. I can consume() that KeyEvent, or setKeyChar to change it to another key. But I cannot see how to change it to a non-keyboard character.
    Any suggestions?

    i think you can do smt likeDocument doc = mySwingTextComponent.getDocument();
    doc.setDocumentFilter(new MyDocumentFilter());
    class MyDocumentFilter extends DocumentFilter {
       public void remove(DocumentFilter.FilterBypass fb, int offset, int length) throws BadLocationException {
          fb.remove(offset,length);
       public void insertString(DocumentFilter.FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
          replace(fb,offset,0,string,attr);
       public void replace(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
          text.replaceAll("SPACE","NB WHITE SPACE");
    }asjf
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/DocumentFilter.html

  • Replacing space with wildcard

    I have a table with names as following -
    WITH T AS(
    SELECT 'JOHN M SMITH' NAME FROM DUAL
    UNION
    SELECT 'ANDREW SMITH' FROM DUAL
    UNION
    SELECT 'A CARREY AND MIKE M N SMITH' FROM DUAL)
    SELECT * FROM T
    My Requirement is that if name is a single character, then attach a wildcard with it, if it is more than a single character followed by space,then attach single space followed by a wildcard, so the final result should be like this :-
    JOHN % M% SMITH
    ANDREW % SMITH
    A% CARREY % AND % MIKE % M% N% SMITH
    probably it will be done with regular expression, but not sure how.
    Thanks in advance

    Anther slightly weird way:
    SQL> WITH T as (
      2  SELECT 'JOHN M SMITH' NAME FROM DUAL UNION
      3  SELECT 'ANDREW SMITH' FROM DUAL UNION
      4  SELECT 'A CARREY AND MIKE M N SMITH' FROM DUAL
      5  )
      6  --
      7  --
      8  --
      9  select rtrim(listagg( case
    10                          when length(word)=1 then word||'% '
    11                          when length(word)>1 then word||' % '
    12                        end
    13                      , ''
    14                      ) within group (order by aid, lvl)
    15              , ' %'
    16              ) newname
    17  from ( select aid
    18         ,      lvl
    19         ,      name
    20         ,      regexp_substr(name, '[^ ]+', 1, lvl) word
    21         from ( select rownum aid
    22                ,      name
    23                from   t
    24              )
    25         cross join ( select level lvl
    26                      from ( select max(length(regexp_replace(name, '[^ ]+')))+1 mx
    27                             from   t
    28                           )
    29                      connect by level <= mx
    30                   )
    31         where regexp_substr(name, '[^ ]+', 1, lvl) is not null
    32         order by aid
    33                , lvl
    34      )
    35  group by name;
    NEWNAME
    A% CARREY % AND % MIKE % M% N% SMITH
    ANDREW % SMITH
    JOHN % M% SMITH
    3 rows selected.

  • Why is Firefox replacing 'space' with '%20' when I try to save a file?

    Alright so when I try to save a file from at least two websites, Firefox is converting the spaces in the file name to '%20'. So for example, instead of 'Firefox rules.doc' it's 'Firefox%20rules.doc'.
    This is NOT a html error, Internet Explorer doesn't have these problems on the exact same websites, and it's only a recent occurance for Firefox.
    EDIT: Have tried re-installing Firefox; diabling add-ons; diabling plugins; updating plug-ins; creating a new profile.

    Are you left-clicking the link when that happens or do you use "Save Link as" the right-click context menu?
    Does it also happen if you hold down the Alt key and left-click?

  • Rplacing space with &nbsb; in html using regular expressions

    Hi
    I want to replace space with &nbsb; in HTML.
    I used  the below method to replace space in my html file.
    var spacePattern11:RegExp =/(\s)/g; 
    str= str.replace(spacePattern," "
    Here str varaible contains below html file.In this html file i want to replace space present between " What number does this  represents" with &nbsb;
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <b><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" style = 'font-size:10px' COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" style = 'font-size:10px' COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B> What number does this Roman numeral represents MDCCCXVIII ?</B></FONT></P></TEXTFORMAT></b>
    </body>
    </html>
    But by using the above regular expression i am getting like this.
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head><body>
    <b><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" style = 'font-size:10px' COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P A LIGN="LEFT"><FONT FACE="Verdana" style = 'font-size:10px' COLOR="#0B333C" LETTERSPACING="0 " KERNING="0"><B> What number does this represents</B></FONT></P></TEXTFORMAT></b>
    </body>
    </html>
    Here what happening means it was replacing space with &nbsb; in HTML tags also.But want to replace space with &nbsb; present in the outside of the HTML tags.I want like this using regular expressions in FLEX
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>What number does this represents</body>
    </html>
    Hi,Please give me the solution to slove the above problem using regular expressions
    Thanks in Advance to all
    Regards
    ssssssss

    sorry i missed some information in above,The modified information was in red color
    Hi
    I want to replace space with &nbsb; in HTML.
    I used  the below method to replace space in my html file.
    var spacePattern11:RegExp =/(\s)/g; 
    str= str.replace(spacePattern," "
    Here str varaible contains below html file.In this html file i want to replace space present between " What number does this  represents" with &nbsb;
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <b><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" style = 'font-size:10px' COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" style = 'font-size:10px' COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B> What number does this Roman numeral represents MDCCCXVIII ?</B></FONT></P></TEXTFORMAT></b>
    </body>
    </html>
    But by using the above regular expression i am getting like this.
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head><body>
    <b><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" style = 'font-size:10px' COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADIN G="2"><P ALIGN="LEFT"><FONT FACE="Verdana" style = 'font-size:10px' COLOR="#0B33 3C" LETTERSPACING="0" KERNING="0"><B> What number does this represents</B></FONT></P></TEXTFORMAT></b>
    </body>
    </html>
    Here what happening means it was replacing space with &nbsb; in HTML tags also.But want to replace space with &nbsb; present in the outside of the HTML tags.I want like this using regular expressions in FLEX
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>What&nbsb;number&nbsb;does&nbsb;this&nbsb;represents</body>
    </html>
    Hi,Please give me the solution to slove the above problem using regular expressions
    Thanks in Advance to all
    Regards
    ssssssss

Maybe you are looking for

  • More Memory = Speed on internet?

    Hi I have an iBook G4 with 256 MB memory. Will the cost of more memory be worth anything in speed when surfing the web? I am talking about loading pages swithching between apps and saving pages. The Activity Monitor always says there is free RAM of l

  • Actual Pixel Value for Screen Res...(Doc Window)...Incorrect in DW ?

    hello again... In Dreamweaver MX 2004...the dropdown menu on the status bar (right corner) of the document window...showing actual pixel dimensions vs. maximized screen resolution... ...for the 1024 X 768 SR...I'm showing actual pixel dimensions of 9

  • Table created in Dataguard and standby

    Hi, in a DATAGUARD_STANDBY configuration, if I create a table in primary DB, will I see it in STANDBY ? How many times after ? What are the parameteres that detemine the time interval ? Many thanks.

  • Incomplete Incoming Emails

    Some of my incoming emails are incomplete and just show boxes full of the letter A.  Even if I upload images it makes no difference.  Can anybody advise me how I might remedy this.  It seems to be emails from companies that are mainly affected.  I ha

  • JServ Configuration

    Hi, good friends, Windows 2000 Oracle 8.1.7 Apache Web Server 1.3.12 Apache JServ 1.1 When I am running XSQL Servlets in the enviroment as mentioned above, an internal server error happened. In the JServ.log file, the following words are there: Servl