-3

Currently this is my code:

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"] . "<br>";

  move_uploaded_file($_FILES["file"]["tmp_name"],"images/" . $_FILES["file"]["name"]);
            echo "images/" . $_FILES["file"]["name"];
            $path="images/" . $_FILES["file"]["name"];
Gerben Jacobs
  • 4,515
  • 3
  • 34
  • 56
user3651840
  • 39
  • 2
  • 9

2 Answers2

0
$image_info = getimagesize($_FILES["file"]["tmp_name"]);
$image_width = $image_info[0];
$image_height = $image_info[1];

You can refer to: http://www.php.net/manual/en/function.getimagesize.php for reference!

NOTE: Check the uploaded file to be image before using "getimagesize" otherwise you will get an error.

GitaarLAB
  • 14,536
  • 11
  • 60
  • 80
Kanishk Dudeja
  • 1,201
  • 3
  • 17
  • 33
0

Try this :

list($width, $height, $type, $attr) = getimagesize($path);
echo "Width is : " . $width;
echo "Height is : " . $height;
  • when i use this code : list($width, $height, $type, $attr) = getimagesize( $_FILES["file"]["tmp_name"]); echo "Width is : " . $width; echo "Height is : " . $height; this error is occur: Warning: getimagesize(C:\xampp\tmp\php2B3A.tmp) [function.getimagesize]: failed to open stream: No such file or directory in C:\xampp\htdocs\testimg\testing.php on line 52 Width is : Height is : – user3651840 May 19 '14 at 08:36
  • you should consider adding some reference and explain why it workrs/should work – Theolodis May 19 '14 at 08:50