On Mon, 2003-07-07 at 00:16, Micah Montoy wrote:
> I'm using the foreach to loop through a array that is passed from a form.
> The form has a multiple select field and the field sends a list of selected
> image locations (i.e. c:\\myimages\\rabbit.gif).  All the fields are
> selected by use of JavaScript before the form is submitted.  Anyway, I am
> getting the error:

Hi there,

> Parse error: parse error, unexpected T_FOREACH in
> c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line 39
> 
> Here is the code that I am using.  The foreach statement is line 39.
> 
> //loop through all the chosen file names and input them individually
> $count = 0

You need a semicolon at the end of the above line.

> foreach ($filename as $filevalue){
> 
>  //get file size function
>  function fsize($file) {
>   $a = array("B", "KB", "MB");
>   $pos = 0;
>   $size = filesize($file);
>   while ($size >= 1024) {
>    $size /= 1024;
>    $pos++;
>      }

This function definition should not be inside the foreach(), since the
second time the loop executes, it will stop and tell you that you can't
redeclare an already defined function (and it was defined on the first
loop).

I haven't checked the rest of it; try the above ideas and see if they
help.


Good luck,

Torben


-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to