d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > New To Web Languages, Need Help
Add Reply New Topic New Poll
Member
Posts: 29,399
Joined: Dec 8 2007
Gold: 4,071.02
Jun 21 2012 06:20pm
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
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jun 21 2012 06:30pm
you dont need a domain to test it.

use xampp
Member
Posts: 29,399
Joined: Dec 8 2007
Gold: 4,071.02
Jun 21 2012 06:48pm
Quote (carteblanche @ Jun 21 2012 05:30pm)
you dont need a domain to test it.

use xampp


ok, will look into that.

edit*
dl'd it, it doesnt do nething when i run Apache
and i can't visit http://localhost/phpmyadmin/

This post was edited by KyoDivine on Jun 21 2012 07:14pm
Member
Posts: 29,399
Joined: Dec 8 2007
Gold: 4,071.02
Jun 21 2012 07:32pm
nvm, skype was using the same port
closed it and it works now
will post again if i run into more problems~
thx for ur help
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll