Problem uploading multiple music files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scarabee
Forum Newbie
Posts: 5
Joined: Sun Jun 18, 2006 3:45 am

Problem uploading multiple music files

Post by scarabee »

Weirdan | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi!

I try to upload music files (.mp3 and .wma) to my website, but get some abscure error saying:
Warning: Invalid argument supplied for foreach() in C:\_disafe\components\com_disafe\upload.php on line 108

Here is the code that seems to be the problem:
foreach ($_FILES["images"]["error"] as $key => $error) {

But the strangest thing is that this works fine uploading images/photo, dokuments and video files. Maybee php has built in a filter keeping people from uploading music? 

Here is the html code:
[syntax="html"]
    <tr><td>Fil: </td><td><input type="file" name="images[]" size="35" /></td></tr>
    <tr><td>Tittel: </td><td><input type="text" name="titles[]" size="53" /></td></tr>
    <tr><td>Info: </td><td><textarea name="descr[]" cols="40"></textarea></td></tr>

    <tr><td colspan="2"><hr /></td></tr>
    <tr><td>Fil: </td><td><input type="file" name="images[]" size="35" /></td></tr>
    <tr><td>Tittel: </td><td><input type="text" name="titles[]" size="53" /></td></tr>
    <tr><td>Info: </td><td><textarea name="descr[]" cols="40"></textarea></td></tr>
Hope someone can help me with this!


Thanks, Sigurd!


Weirdan | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

$_FILES['fieldname'] is an array. $_FILES['fieldname']['error'] is not, it's just a value. You can't loop over it.
Post Reply