Jump to content

how to get array values


anand.arjunan

Recommended Posts

Hi all i got a print_r($_FILES);output is Array ( [file_1] => Array ( [name] => [type] => [tmp_name] => [error] => 4 => 0 ) [file_0] => Array ( [name] => AT.jpg [type] => image/pjpeg [tmp_name] => /tmp/php5K8RLS [error] => 0 => 3481 ) ) here how to get "AT.jpg" separatelymy coding is <form name="exap" enctype="multipart/form-data" method = "post"> <!-- The file element -- NOTE: it has an ID --> <input id="my_file_element" type="file" name="file_1[]" > <input type="button" onClick="return frm_sub();" value="submit"></form>...............

Link to comment
Share on other sites

If you look at the source code that displays line breaks, the output of print_r looks more like this:

Array (   [file_1] => Array ( 	[name] => 	[type] => 	[tmp_name] => 	[error] => 4 	[size] => 0   )   [file_0] => Array ( 	[name] => AT.jpg 	[type] => image/pjpeg 	[tmp_name] => /tmp/php5K8RLS 	[error] => 0 	[size] => 3481   ) )

To access, for example, the name AT.jpg, it would be $_FILES['file_0']['name'].

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
×
×
  • Create New...