コード例 #1
0
    public void getfiles(string dir)
    {
        ddFilesAudio.Items.Clear();

        ListItem li1 = new ListItem();

        li1.Text  = "-- select --";
        li1.Value = "-1";

        ddFilesAudio.Items.Add(li1);

        ArrayList af = new ArrayList();

        string[] Filesaudio = Directory.GetFiles(dir);
        foreach (string fileaudio in Filesaudio)
        {
            string appdir   = Server.MapPath("~/App_Uploads_Audio/") + ddCatAudio.SelectedValue;
            string filename = fileaudio.Substring(appdir.Length + 1);

            if ((!filename.Contains("_svn")) && (!filename.Contains(".svn")))
            {
                if (filename.ToLower().Contains(".mp3"))
                {
                    ListItem li = new ListItem();
                    li.Text  = filename;
                    li.Value = filename;
                    ddFilesAudio.Items.Add(li);
                }
            }
        }
        UpdatePanel1Audio.Update();
    }
コード例 #2
0
    protected void LinkButton1A_Click(object sender, EventArgs e)
    {
        RadUploadContext upContext = RadUploadContext.Current;
        string           faudio    = "";
        string           diraudio  = Server.MapPath("~/App_Uploads_Audio/");

        if (RadUploadAudio.UploadedFiles.Count > 0)
        {
            foreach (UploadedFile fileaudio in RadUploadAudio.UploadedFiles)
            {
                if (fileaudio.FileName.Contains("'"))
                {
                    faudio = fileaudio.FileName.Replace("'", "");
                }
                else
                {
                    faudio = fileaudio.FileName;
                }
                if ((DropDownList1A.SelectedIndex == 0) && (tbDirectoryAudio.Text.Length == 0))
                {
                    Session["cataudio"]   = null;
                    Session["Filesaudio"] = null;
                    TabPanel3Audio.Focus();
                }
                else if ((DropDownList1A.SelectedIndex == 0) && (tbDirectoryAudio.Text.Length > 0))
                {
                    Directory.CreateDirectory(diraudio + tbDirectoryAudio.Text);
                    fileaudio.SaveAs(Server.MapPath("~/App_Uploads_Audio/" + tbDirectoryAudio.Text + "/" + faudio), true);
                    Session["cataudio"]   = tbDirectoryAudio.Text;
                    Session["Filesaudio"] = faudio;
                }

                else if ((DropDownList1A.SelectedIndex != 0) && (tbDirectoryAudio.Text.Length > 0))
                {
                    Directory.CreateDirectory(diraudio + DropDownList1A.SelectedItem.Text + "/" + tbDirectoryAudio.Text);
                    fileaudio.SaveAs(Server.MapPath("~/App_Uploads_Audio/" + DropDownList1A.SelectedItem.Text + "/" + tbDirectoryAudio.Text + "/" + faudio), true);
                    Session["cataudio"]   = DropDownList1A.SelectedItem.Text + "/" + tbDirectoryAudio.Text;
                    Session["Filesaudio"] = faudio;
                }

                else if ((DropDownList1A.SelectedIndex > 0) && (tbDirectoryAudio.Text.Length == 0))
                {
                    fileaudio.SaveAs(Server.MapPath("~/App_Uploads_Audio/" + DropDownList1A.SelectedItem.Text + "/" + faudio), true);

                    Session["cataudio"]   = DropDownList1A.SelectedItem.Text;
                    Session["Filesaudio"] = faudio;
                }
                GC.Collect();
            }
        }

        getfolders(ref al, Server.MapPath("~/App_Uploads_Audio/"));
        getallfolders(ref al2, Server.MapPath("~/App_Uploads_Audio/"));


        UpdatePanel1Audio.Update();
        UpdatePanel2Audio.Update();
        getcontent();
    }
コード例 #3
0
    private void showaudio(string folder, string file)
    {
        atagAudio.Visible = true;
        atagAudio.HRef    = "~/App_Uploads_Audio/" + folder.Replace("\\", "/") + "/" + file;
        atagAudio.Title   = file;

        UpdatePanel1Audio.Update();
    }
コード例 #4
0
 protected void ddCatAudio_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddCatAudio.SelectedIndex > 0)
     {
         ddFilesAudio.Enabled = true;
         getfiles(Server.MapPath("~/App_Uploads_Audio/") + ddCatAudio.SelectedItem.Value);
         UpdatePanel1Audio.Update();
     }
 }
コード例 #5
0
 protected void getcontent()
 {
     if ((Session["cataudio"] != null) && (Session["Filesaudio"] != null))
     {
         ddCatAudio.SelectedValue = Session["cataudio"].ToString().Replace("\\", "/");
         getfiles(Server.MapPath("~/App_Uploads_Audio/") + ddCatAudio.SelectedValue);
         ddFilesAudio.SelectedValue = Session["Filesaudio"].ToString();
         showaudio(ddCatAudio.SelectedItem.Value, ddFilesAudio.SelectedItem.Value);
     }
     UpdatePanel1Audio.Update();
 }