I'm trying to make two image upload boxes inside custom posts which will be shown in a widget like
team 1 logo - team 1 name - team 1 score vs team 2 score - team 2 name - team logo.
These two upload boxes for two logos (team 1 and team2) appear- The first one works fine, but in the second one, the image gets uploaded to the first box.
If I manually add a link to the second it works, but I need an option to upload the image to the second box as well. I need to somehow make it so that it accepts two id's for the same thing, because i think that's the issue as they both have 'type' => 'upload',
I'v added only for one, but i dont know how inside this code http://pastebin.com/JyT8mnS1 to change it so it can accept image uploader for both arrays.
My code is
array(
'name' => 'Home Team Logo',
'desc' => 'Chose Home Team Logo',
'label' => 'Images',
'id' => 'teamlogo1',
'type' => 'upload',
'std' => 'Browse',
'class' =>'upload_image_button'
),
array(
'name' => 'Away Team Logo',
'desc' => 'Chose Away Team Logo',
'label' => 'Images',
'id' => 'teamlogo2',
'type' => 'upload',
'std' => 'Browse',
'class' =>'upload_image_button'
),
If needed my javascript code is this http://pastebin.com/RG4YASuj
Just to inform you I'm completly newbie with this, so i would prefer some example from which i could learn more and actually make it work.
HI you form should be like this:userfile[] is creating an array of images
<form action="file-upload.php" method="post" enctype="multipart/form-data">
Send these files:<br />
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input type="submit" value="Send files" />
</form>
From http://php.net/manual/en/features.file-upload.multiple.php