Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(is_file($_FILES['arquivo']['tmp_name'])){
- $foto = $_FILES['arquivo']['name'];
- if(!eregi("^image\/(jpeg|png|jpg)$", $_FILES['arquivo']['type'])){
- echo "
- <META HTTP-EQUIV=REFRESH CONTENT='0; URL=index.html'>
- <script type=\"text/javascript\">
- alert(\"Formato inválido\");
- </script>
- ";
- }else{
- if(file_exists("uploads/$foto")){
- $a = 1;
- while(file_exists("uploads/[$a]$foto")){
- $a++;
- }
- $foto = "[".$a."]".$foto;
- }
- if(!move_uploaded_file($_FILES['arquivo']['tmp_name'], "uploads/".$foto)){
- echo "
- <META HTTP-EQUIV=REFRESH CONTENT='0; URL=index.html'>
- <script type=\"text/javascript\">
- alert(\"Erro ao enviar o arquivo.\");
- </script>
- ";
- }
- }
- header("Location: index.html");
- }else{
- header("Location: index.html");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement