Page 1 of 1

Problem uploading multiple music files

Posted: Sun Jun 25, 2006 5:47 am
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]

Posted: Sun Jun 25, 2006 7:37 am
by Chris Corbyn
$_FILES['fieldname'] is an array. $_FILES['fieldname']['error'] is not, it's just a value. You can't loop over it.