Rename the uploading Image
<p>i am uploading the image into the server , need to place the _ in place of gap in the image. Like if the name of image is Stack Flow.jpg, i need to send it as Stack_Flow.jpg in the directory as well in the email. HOw could be possible with the following code. i have tried but no success.. I am sending the 4 files in one form, code as --- </p>

<pre><code>$filea = $_FILES['FILE1']['name'];
        $fileb = $_FILES['FILE2']['name'];
        $filec = $_FILES['FILE3']['name'];
        $filed = $_FILES['FILE4']['name'];


$order_image_a='order_'.$orderId.'_'.$filea;
        if(!empty($filea)) move_uploaded_file($_FILES['FILE1']['tmp_name'], "../files/$order_image_a");

        $order_image_b='order_'.$orderId.'_'.$fileb;
        if(!empty($fileb)) move_uploaded_file($_FILES['FILE2']['tmp_name'], "../files/$order_image_b");

        $order_image_c='order_'.$orderId.'_'.$filec;
        if(!empty($filec)) move_uploaded_file($_FILES['FILE3']['tmp_name'], "../files/$order_image_c");

        $order_image_d='order_'.$orderId.'_'.$filed;
        if(!empty($filed)) move_uploaded_file($_FILES['FILE4']['tmp_name'], "../files/$order_image_d");
</code></pre>

<p>i am using below function, how could i apply it for all four files-- </p>

<pre><code>&lt;script&gt;
function convertSpecialChars($str) {
    $str = str_replace( " ", "_", $str );
    return $str;
}
&lt;/script&gt;
</code></pre>
