php - Remove acents when uploading -


hi have code upload files, , works fine, when want download files folder , have acents page doesn't download.

example: /prova%20de%20aptidão%20profissional.png

the requested url /prova de aptidão profissional.png not found on server.

    <html> <body>  <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">filename:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="submit"> </form>  </body> </html>    <?php $allowedexts = array("gif", "jpeg", "jpg", "png"); $temp = explode(".", $_files["file"]["name"]); $extension = end($temp); if ((($_files["file"]["type"] == "image/gif") || ($_files["file"]["type"] == "image/jpeg") || ($_files["file"]["type"] == "image/jpg") || ($_files["file"]["type"] == "image/pjpeg") || ($_files["file"]["type"] == "image/x-png") || ($_files["file"]["type"] == "image/png")) && in_array($extension, $allowedexts))   {   if ($_files["file"]["error"] > 0)     {     echo "return code: " . $_files["file"]["error"] . "<br>";     }   else     {     echo "upload: " . $_files["file"]["name"] . "<br>";     echo "type: " . $_files["file"]["type"] . "<br>";     echo "size: " . ($_files["file"]["size"] / 1024) . " kb<br>";     echo "temp file: " . $_files["file"]["tmp_name"] . "<br>";      if (file_exists("upload/" . $_files["file"]["name"]))       {       echo $_files["file"]["name"] . " exists. ";       }     else       {       move_uploaded_file($_files["file"]["tmp_name"],       "upload/" . $_files["file"]["name"]);       echo "stored in: " . "upload/" . $_files["file"]["name"];       }     }   } else   {   echo "invalid file";   } ?> 

try

urlencode($_files["file"]["name"]); 

it better filter out characters & not putting spaces in folders tho.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -