Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2004, 09:05 AM
Authorized User
 
Join Date: Sep 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default control size of image fail...

hello, i have a problem. I wrote a simple php code that checks size of an image. The problmem is: if the image size is less then 1024 kbyte the check appear ok and the returned value is correct, but if the image size is greater then 1024 kbyte, the check return 0.

Php doesen't recognize values greater the 1024 kbyte? Where is the problem?

i use php 4.32 + server apache.

this is the check code:


<?php
if (isset($_POST['button'])) {

$file = $_FILES['ico']['name'];
$size = $_FILES['ico']['size'];

echo $file . " da " . $size . " byte";

}
 ?>
<html>
<head>
<title>Untitled</title>
</head>
<body>

<form action='<?php $_SERVER['PHP_SELF'] ?>' method='post' enctype='multipart/form-data'>
<input type="file" name='ico' class="border4">
<input type='submit' name='button' value='inserisci' class='border2'>

</form>

</body>
</html>

 
Old April 20th, 2004, 12:59 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Hi Joeore,

Check the following php.ini directive, this may be set to 1M instead of the default value of 2M.

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

hth,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old April 22nd, 2004, 01:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also, you need to ECHO the value of PHP_SELF. Your code doesn't echo it to the screen, so I wouldn't be surprised if your form action was an empty string.

this might cause a problem with some browsers. most browsers will treat an empty or missing form action as "submit to the same page".


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
set up image size goldenstate BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 February 15th, 2007 07:37 PM
Image size? Olaf_l ASP.NET 1.0 and 1.1 Basics 1 May 9th, 2005 05:56 AM
Image Size kilika Classic ASP Basics 2 July 18th, 2003 01:05 PM
Image size kilika Classic ASP Professional 3 July 16th, 2003 09:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.