Test upload of image of 4,5 mb = No info |
Guru master
|
Nothing to do with PhpED or the debugger. I have *never* found either of those to interfere with running code, except the occasional strange problem when there are active watches in debug mode. That is not PhpED's fault, that was my fault and very unlikely to be the problem in this case.
Have you set both post_max_size and upload_max_size, with post_max_size being equal to or greater than upload_max_size? http://php.net/manual/en/ini.core.php#ini.post-max-size
If JPG does not work, it is possible that the PHP code for controlling the upload is doing something. PHP code can even change the $_FILES array if it wants to. Is it your own code or from someone else? |
||||||||||||||
|
|
Hello
post_max_size = 8M ; Maximum allowed size for uploaded files. PhpED comes with 2M on install changed to 5M sp now it is upload_max_filesize = 5M The code is a mix of own code and copied from other developer ------------------------------------------------------------------------ This code when uploading a 4,5mb image.jpg will result in a false value when testing for mimetype. A smaller image is ok. Tested with 1.5mb ------------------------------------------------------------------------ <?php if ($_FILES) { $name = $_FILES['filename']['name']; switch($_FILES['filename']['type']) { case 'image/pjpeg': $ext = 'jpg'; break; case 'image/jpeg': $ext = 'jpg'; break; case 'image/gif': $ext = 'gif'; break; case 'image/png': $ext = 'png'; break; default: $ext = ''; break; } if ($ext) { $gmtime = (int)gmdate('U'); $n = "upload/image.$ext"; move_uploaded_file($_FILES['filename']['tmp_name'], $n); echo "Uppladdad bild '$name' as '$n': <br/> "; echo "<img src='$n' /> "; function compress_image($source_url, $destination_url, $quality) { $info = getimagesize($source_url); list($width, $height) = getimagesize($source_url); if ($info['mime'] == 'image/jpeg') $image = imagecreatefromjpeg($source_url); elseif ($info['mime'] == 'image/pjpeg') $image = imagecreatefromjpeg($source_url); elseif ($info['mime'] == 'image/gif') $image = imagecreatefromgif($source_url); elseif ($info['mime'] == 'image/png') $image = imagecreatefrompng($source_url); //save it imagejpeg($image, $destination_url, $quality); return $destination_url; } $source_photo = "$n"; $dest_photo = "upload/image$gmtime.$ext"; $d = compress_image($source_photo, $dest_photo, 50); echo "<img src='$d' /> "; } else echo " '$name' är inte en godkänd bildfil"; } else echo " Ingen bildfil har blivit uppladdad"; ?> |
||||||||||||
_________________ SB |
Guru master
|
The MIME file 'type' element is provided by the browser and not by PHP, so it can be incorrect, unset or even faked. It is possible that your browser is providing a different MIME type for jpg and JPG. What about using just the file extension for your checking?
Have you checked phpinfo() to ensure those max settings have been applied? Have a look at this URL for some possible clues: http://stackoverflow.com/questions/3586919/why-would-files-be-empty-when-uploading-files-to-php |
||||||||||||
|
|
Hello plugnplay
Thanx for your help. There were actually 2 php.ini files residing on my pc. C:\Program\NuSphere\PhpED\php55 and C:\Program Files (x86)\NuSphere\PhpED\php5 First I made changes to the php.ini file under C:\Program Files (x86)\NuSphere\PhpED\php5. But i used the phpinfo() to list the upload info. I found the other php.ini file under C:\Program\NuSphere\PhpED\php55 So after editing and increasing from 2M to 5M and restart Nusphere it worked fine to run a upload with a larger file. BUT do you know how webserverhotels usually configure max upload configurations? There is one thing to run it locally and another up there Brgds Stefan |
||||||||||||
_________________ SB |
Guru master
|
If you are using shared hosting, you might not be able to change the maximum upload size but normally they would already be reasonable maximums. On our web servers we normally set at least 8GB. Some shared hosting control panels might even allow you to set your own maximums.
If you are using a dedicated or virtual server, you will probably be able to change any setting you like. Bear in mind that whilst the built-in PhpED web server gives you normal PHP, it is not an Apache web server. Because Apache does interact with PHP such as setting certain PHP global variables, depending on what your code is doing it may find differences when running on Apache. Ideally you should install the same type of web server as your hosting so that you can test properly. You can use a WAMP distribution for doing that, but if you already have a database server installed which you are happy with then you could instead use the NuSphere TechPlatform. |
||||||||||||
|
Test upload of image of 4,5 mb = No info |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by