Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_FILES["file"]))
- {
- if ($_FILES["file"]["error"] > 0)
- {
- echo "Error.";
- }
- else
- {
- $allowed="jpg";
- $ext=substr($_FILES["file"]["name"],strrpos($_FILES["file"]["name"],".")+1);
- if(($_FILES["file"]["type"] == "image/jpeg")
- &&$allowed==$ext&&
- $_FILES["file"]["size"] < 300000000)
- {
- echo "Upload: " . $_FILES["file"]["name"] . "<br>";
- echo "Type: " . $_FILES["file"]["type"] . "<br>";
- echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
- echo "Stored in: " . $_FILES["file"]["tmp_name"];
- move_uploaded_file($_FILES["file"]["tmp_name"],
- "here/image.jpg");
- }
- else echo "Error.";
- }
- }
- else
- {/**/
- ?>
- <html>
- <body>
- <form action="index.php" method="post" enctype="multipart/form-data">
- <input type="file" name="file" id="file"><br/>
- <input type="text" name="pc"><br/>
- <input type="submit" name="submit" value="Submit">
- </form>
- </body>
- </html>
- <?php
- //*/
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment