Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Arquivo PHP de upload -->
- <?php
- $photos = $_FILES['photos'];
- $path = 'uploads/imgs/';
- if (!is_dir($path)) {
- mkdir('uploads');
- mkdir($path);
- }
- for ($i = 0; $i < count($photos['name']); $i++) {
- $j = $i + 1;
- if ( move_uploaded_file($photos['tmp_name'][$i], $path . $photos['name'][$i]) )
- echo "Sucesso ao mover o arquivo {$j} <br>";
- else
- echo "Falha ao mover o arquivo {$j} <br>";
- ?>
- <!-- Arquivo html -->
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Upload</title>
- <link rel="stylesheet" href="bootstrap.min.css">
- </head>
- <body>
- <div class="container">
- <h1>Upload</h1>
- <form class="form" method="POST" action="upload.php" enctype="multipart/form-data">
- <div class="form-group">
- <input type="file" name="photos[]" class="form-control" multiple>
- </div>
- <div class="form-group">
- <button type="submit" class="btn btn-primary">Enviar</button>
- </div>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement