Jump to content

File info from uploaded files


Bogey
 Share

Recommended Posts

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.jpg
tempname:
size: 0
type:

PictB:

 

 

name: PictB.jpg
tempname:
size: 0
type:

PictC:

 

 

name: PictD.jpg
tempname:
size: 0
type:

PictD:

 

 

name: PictD.jpg
tempname: /tmp/phpAX5a1G
size: 1964351
type: image/jpeg

PictE:

 

 

name: PictE.jpg
tempname: /tmp/phpVmeMDk
size: 1756983
type: image/jpeg

PictF:

 

 

name: PictF.jpg
tempname: /tmp/phphSoeDv
size: 1437825
type: 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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...