Jump to content

Reading extensions, an a bit of arrays...


AncientSage

Recommended Posts

Hello,

This code, is supposed to read the name of the uploaded file, and if it doesn't match an extension, then it returns error.

However, it just loads, and NOTHING is returned... (not my success script, which is not included here, and does work, or my error script)

[code]
        //Begin query, and this is working, it's a database abstraction layer.
      $sql = "SELECT config_value
                  FROM config
                  WHERE config_name='allowed_file_ext'";
        $extensions = $db->sql_fetchrow($sql);
        //End Database Query...
        $read_extensions = '(' . unserialize($extensions) . ')';

  if(preg_match("#$read_extensions$#", $_FILES['file']['name']))
  {
      $is_songfile = $_FILES['file']['name'];
  } else {
    //error goes here
}
[/code]

The SQL inserted earlier...

[code]
INSERT INTO phpbb_jukebox_config (config_name, config_value) VALUES ('allowed_file_ext', '{.mid, .mp3, .wav, .aiff}');
[/code]

Any ideas at to what I am doing wrong here?
Link to comment
https://forums.phpfreaks.com/topic/16389-reading-extensions-an-a-bit-of-arrays/
Share on other sites

Well, it's returning my error now, but if I upload a file within the allowed extensions, it still returns in error.  Probably an SQL error now, that or what it is getting from the database is not what I intend it to, I should be able to fix that.

Anyway, thanks for the help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.