Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. fileuplode control file uploda problem [modified]

fileuplode control file uploda problem [modified]

Scheduled Pinned Locked Moved ASP.NET
helpquestionsysadmintutorialannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    UD IA
    wrote on last edited by
    #1

    i have this code to upload a file file is upload name is id of the field for unique but now when i go for this folder there is no file type show. i want that if i store .rar than show .rar, if user store .zip show .zip extension, if user store .png show .png how can i do this. plz some one help me? my code is given above plz check is its right or not and what made change to convert like i want. i got file extension but now i would like to know when i show this path in link button how to load client when click on this link plz some one help me in this topic. thanks in advance. :-D

    protected void btn_add_issue1_Click(object sender, EventArgs e)
    {
    DataTable tbl1 = dt.filltbl("select * from tbl_issue where id=-1", "new1");
    DataRow row1 = tbl1.NewRow();
    row1["issue_id"] = ViewState["max"].ToString(); ;
    row1["prefix"] = ViewState["prefix"].ToString();
    row1["Project_id"] = Convert.ToInt32(ddl_projects.SelectedValue);
    row1["project_name"] = Convert.ToString(ddl_projects.SelectedItem);
    row1["issue_title"] = txt_issue.Text;
    row1["issue_type"] = Convert.ToString(ddl_issue.SelectedItem);
    row1["issue_desc"] = FreeTextBox1.Text;
    row1["status"] = "Open";
    row1["svdate"] = DateTime.Now.Date.ToShortDateString();
    row1["svtime"] = DateTime.Now.ToShortTimeString();
    tbl1.Rows.Add(row1);
    dt.update(tbl1, "select * from tbl_issue");

        fillissueid();
        FreeTextBox1.Text = "";
        txt\_issue.Text = "";
        
        object max = dt.getmax("select max(id) from tbl\_issue");
        if (fu\_attachment.FileName != "")
        {
            DataTable tblco = dt.filltbl("select \* from tbl\_issue where id=" + max, "maxx");
            DataRow r1 = tblco.Rows\[0\];
            string a = Convert.ToString(max);
            string str = "~/Data1/";
            str = Server.MapPath(str);
            str = str + a ;
            fu\_attachment.SaveAs(str);
            r1\["issue\_attach"\] = "~/Data1/" + a ;
            dt.update(tblco, "select \* from tbl\_issue");
        }
        Page.RegisterStartupScript("myrest", "alert('New issue was added successfully');");
        Response.Redirect("default.aspx");
    }
    

    :-D

    I will do my best? Integrated Solutions, Bikaner (Raj.), India

    modified on Monday, September 29, 2008 10:50 AM

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups