how to make an array

View: New views
2 Messages — Rating Filter:   Alert me  

how to make an array

by FabioVaz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

while i put files... just increse the "name field"+1
exemple:

a
a1
a2
a3
a4
a5
a6....

i need it in one array
exemple

a[0] = a
a[1] = a1
a[2] = a2
a[3] = a3
a[4] = a4
a[5] = a5
a[6] = a6

somebody can help me?

(for in php site, i do on for<sizeof...

cause i cant "count" the number of photos to upload X times...

thks

Re: how to make an array

by kenyansoul :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

change this
//e.name = (e.name || x.attr('name') || 'file') + (e.i>0?e.i:''); // same name as master element
to this

e.name = 'upload[]'; // same name as master element

if you are using php....verify it using this, just for precaution


         /*Loop through images and check for size and type. if no image is uploaded no error generated
         */
$types_array = array('image/gif','image/pjpeg','image/jpeg');
$max_filesize = 1024000;
       
         foreach (($_FILES['upload']['name']) as $key=> $value){
 
 
       
        if (file_exists($_FILES['upload']['tmp_name'][$key]))
            {
           



        if(!in_array($_FILES['upload']['type'][$key], $types_array))
        {

   
      $arr_errs['upload']="wrong type";
          $err=true;
        }
        if($_FILES['upload']['size'][$key] > $max_filesize)
                        {
     $arr_errs['upload]="file too big";
          $err=true;
   
                        }
            }
                 
                 
                 
}


                                                               




FabioVaz wrote:
while i put files... just increse the "name field"+1
exemple:

a
a1
a2
a3
a4
a5
a6....

i need it in one array
exemple

a[0] = a
a[1] = a1
a[2] = a2
a[3] = a3
a[4] = a4
a[5] = a5
a[6] = a6

somebody can help me?

(for in php site, i do on for<sizeof...

cause i cant "count" the number of photos to upload X times...

thks