Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Array in an Array

Posted on 2007-11-14
5
Medium Priority
?
230 Views
Last Modified: 2008-02-01
When I am retrieving the value for the $_FILES super global I am getting Array returned.  How do I get the value of the elements inside the array to get returned?

<label for="file"><strong>File:</strong> <?php echo $details['file'] ?></label><br />

Form
<?php foreach ($cars as $car => $details) { ?>
<h3><?php print $car ?></h3>
  <label for="format"><strong>Format:</strong> <?php echo $details['format'] ?></label><br />
  <label for="rotation"><strong>Rotation(%):</strong> <?php echo $details['rotation'] ?></label><br />
  <label for="size"><strong>Size:</strong>
  <?php echo $details['724x90']; ?> &nbsp;
  <?php echo $details['300x250']; ?> &nbsp;
  <?php echo $details['160x600']; ?></label> &nbsp; &nbsp; &nbsp;
  <label for='other'><strong>Other:</strong> <?php echo $details['othertx'] ?> </label><br />
  <label for="layout"><strong>Layout:</strong> <?php echo $details['layout'] ?></label><br />
  <label for="bannerlink"><strong>Banner Link:</strong> <?php echo $details['bannerlink'] ?></label><br />
  <label for="file"><strong>File:</strong> <?php echo $details['file'] ?></label><br />
  <label for="dspecific"><strong>Deal Specifics:</strong> <?php echo $details['dspecific'] ?></label><br />
  <label for="disclaimer"><strong>Disclaimer:</strong> <?php echo $details['disclaimer'] ?></label><br /><br /><br />
<?php  }  ?>

0
Comment
Question by:taynet29
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 20

Assisted Solution

by:steelseth12
steelseth12 earned 1400 total points
ID: 20283129
$_FILES['name_your_file_field']['name'] will give you the name of the uploaded file.

$_FILES['name_your_file_field']['type'] gives you the type

$_FILES['name_your_file_field']['size'] gives you the size

$_FILES['name_your_file_field']['tmp_name'] gives you the temporary name the file is stored in ...
For example to move the file to your server you would do

move_uploaded_file($_FILES['name_your_file_field']['tmp_name', 'destination/directory/name_of_file.jpg')

$_FILES['name_your_file_field']['error'] gives you the error if any
0
 
LVL 11

Assisted Solution

by:jgordos
jgordos earned 600 total points
ID: 20283138
Generally, you can print the entire array by just

print_r($a);

where $a is the array.

I'm not sure, exactly, what you're asking.

0
 
LVL 11

Assisted Solution

by:jgordos
jgordos earned 600 total points
ID: 20283153
0
 

Author Comment

by:taynet29
ID: 20283532
All the arrays are being printed on the "Work Order Review" page.  All I am asking is how do I get the variable to print as an array.  Keep in mind it is being stored as an Array in $details.  Then the $_FILES array.  As a result, <?php echo $details['file'] ?> prints ---> Array.  

What I have tried is
<?php if(isset($_FILES["file"][0])) ?>
<?php if(isset($_FILES["file"]["name"])) ?>
<?php if(isset($details["file"][1])) ?>
<?php if(isset($details["file"]["name"])) ?>

They all do not return a value.

Please let me know what I am doing incorrectly.  How do I print the file name?
0
 
LVL 20

Accepted Solution

by:
steelseth12 earned 1400 total points
ID: 20283816
<?php echo $details['file']['name_of_field']['name'] ?> should do it
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question