Note that there are some explanatory texts on larger screens.

plurals
  1. POphp Form fileupload problem with whitespaces in filename
    primarykey
    data
    text
    <p>I still have the problem with whitespaces:</p> <p>I have an uploadform for users to upload mp3-files. It works fine, except when there are whitespaces in the filename. At the moment I tell the user not to use Filenames with whitespaces, but apparently its very common to use them in mp3s. So I would like to solve this problem. What happens is this:</p> <p><strong>Normally:</strong></p> <p>A user selects a file without whitespaces with an html file-input form:</p> <pre><code>&lt;form method="post" enctype="multipart/form-data" name="form2" id="form2" action="' . $_SERVER[PHP_SELF] . '"&gt; &lt;input type="file" style="color:#888888" name="file" id="file" /&gt; </code></pre> <p>Then, on the serverside I handle the file with </p> <pre><code>copy($_FILES['file']['tmp_name'], $newfilename); </code></pre> <p>This works fine.</p> <p><strong>NOT normally:</strong></p> <p>A user selects a file with whitespace in the filename. The print_r($_POST) looks like this:</p> <pre><code>Array ( [x] =&gt; 21 [y] =&gt; 32 ) </code></pre> <p>And the print_R($_FILES) looks like this:</p> <pre><code>Array ( [file] =&gt; Array ( [name] =&gt; 11. test with spaces.mp3 [type] =&gt; [tmp_name] =&gt; [error] =&gt; 1 [size] =&gt; 0 ) ) </code></pre> <p>As the tmp_name is empty, the script can't acess the file and there we have an ugly error... So what I think I need is to manipulate the [tmp_name], so that it has no whitespaces, because my Apache/Linux Server seems to have a problem with it. Has anyone any ideas how to solve this?</p> <p>Greetz and Thanks</p> <p>Maenny</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload