hey guys im currently a CS major student
i'm doing a little side project with mess around with web languages for educational purposes
im completely new to web languages, i've worked with java and C++ before in classes
im looking to write a simple website to allow someone to upload a .jpeg file and then it will display infos of the .jpeg onto the screen
such as the width/height, file size, exc.
i did some research online and this is what i came up with:
<html>
<body>
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
Please choose a .jpeg file:<br>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
<?php
if ($_FILES["file"]["type"] == "image/jpeg")
{
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_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 "Stored in: " . $_FILES["file"]["tmp_name"];
}
}
else
{
echo "Invalid file";
}
list($width, $height, $type, $attr) = getimagesize("tmp_name.jpg");
echo "Image width " .$width;
echo "<BR>";
echo "Image height " .$height;
echo "<BR>";
echo "Attribute " .$attr;
?>
would this work? if not plz point me to the right direction
how do i test this? ne one here know a free server i can use and set up a free domain??
any help is greatly appreciated
-cheers