Bogey Posted May 17, 2016 Share Posted May 17, 2016 Hi all, I have an issue with uploading jpg-files. I have 6 jpg's of different bytes... the smaller ones go well, the bigger files don't. This are my files: PictA.jpg 6.535 kB PictB.jpg 2.422 kB PictC.jpg 2.342 kB PictD.jpg 1.919 kB PictE.jpg 1.716 kB PictF.jpg 1.405 kB This is the piece of code I am running: if (isset($_POST["upload"])){ $userfile_name = $_FILES['image']['name']; echo "name: " . $userfile_name . "<br />"; $userfile_tmp = $_FILES['image']['tmp_name']; echo "tempname: " . $userfile_tmp . "<br />"; $userfile_size = $_FILES['image']['size']; echo "size: " . $userfile_size . "<br />"; $userfile_type = $_FILES['image']['type']; echo "type: " . $userfile_type . "<br />"; die; } This is the output: PictA: name: PictA.jpgtempname: size: 0type: PictB: name: PictB.jpgtempname: size: 0type: PictC: name: PictD.jpgtempname: size: 0type: PictD: name: PictD.jpgtempname: /tmp/phpAX5a1Gsize: 1964351type: image/jpeg PictE: name: PictE.jpgtempname: /tmp/phpVmeMDksize: 1756983type: image/jpeg PictF: name: PictF.jpgtempname: /tmp/phphSoeDvsize: 1437825type: image/jpeg How comes the bigger files (A, B and C) don't echo the info and the smaller files (D, E and F) do echo the right info? any clues? Link to comment Share on other sites More sharing options...
Bogey Posted May 17, 2016 Author Share Posted May 17, 2016 I guess there is some setting on the server, who tells not to upload bigger files then 2Mb? If so, where can I find this? Link to comment Share on other sites More sharing options...
Ingolme Posted May 17, 2016 Share Posted May 17, 2016 In php.ini there are rules such as "max_file_size" and "post_max_size" max_file_size indicates the maximum size an uploaded file can have, post_max_size indicates the maximum allowed size of the entire POST request, including the files and other form data. You should be checking for upload errors in the $_FILES['image']['error'] property. If the value of that property is anything other than zero you should display a message to the user letting them know what went wrong. Link to comment Share on other sites More sharing options...
Bogey Posted May 17, 2016 Author Share Posted May 17, 2016 Thanks for your quick response!!!!! on the biggers files it gives an error "1" on the smaller files "0" When I try phpinfo, then I get this location of my php.ini file: /opt/alt/php56/etc Is it possible to adjust that file? How do I come there? Link to comment Share on other sites More sharing options...
Ingolme Posted May 17, 2016 Share Posted May 17, 2016 If you're on a web host you probably should check their knowledgebase or send them a support ticket. If this is your own server then just go to that directory and change the file. Link to comment Share on other sites More sharing options...
Bogey Posted May 17, 2016 Author Share Posted May 17, 2016 Thank you... I go contact my host about it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now