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
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.