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
H

HumaMunir

@HumaMunir
About
Posts
5
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Uploaded files are excluded from the folder
    H HumaMunir

    Kornfeld Eliyahu Peter wrote:

    What the connection between show an uploaded file to everyone and to make a part of the project!!!
    You are talking nonsense here.
    Upload the file, store it anywhere you want (and can), probably store a reference in your database, then present a link to the uploaded file to everyone should see it...

    This is my criteria to store my file in my project. I am not talking non sense. May be you are overwhelmed with your so called knowledge. That’s ok if you can’t solve my problem but please learn to behave!

    Regards HumaMunir

    Web Development csharp asp-net sysadmin help question

  • Uploaded files are excluded from the folder
    H HumaMunir

    Thanks for the reply. Please check out this image, I dont think its the issue of path or privileges because the files are uploaded in the folder but they are not included in the project. https://drive.google.com/file/d/0Bw5Y6qnYiUrFRGxscjRVYUpXc0U/edit?usp=sharing[^]

    Regards HumaMunir

    Web Development csharp asp-net sysadmin help question

  • Uploaded files are excluded from the folder
    H HumaMunir

    Bernhard Hiller wrote:

    That's a very bad, really terrible, coding practice. Don't do so.

    Thank a lot for the advice but I have a check I am handling it on button click for now, will change it once I get the uploading fixed.

    Bernhard Hiller wrote:

    Also note: how will you later be able to access those files? Do you have some database table or some other mechanism to find out which files exist and to generate the html links to them?

    Following is my button click event, I hope this will help you understand the rest of the code and yes I am storing it in the database and displaying them on another page in a grid.

    protected void btnAdd_Click(object sender, EventArgs e)
    {
    string isBest;

        if (cbIsBest.Checked)
        {
            isBest = "Yes";
        }
        else
        {
            isBest = "No";
        }
        string picPath = UploadPicture(); // uploads picture using file upload control and stores it in ImgNewsletter folder
        string newsletterPath = UploadNewsletter(); // uploads newsletter using file upload control and stores it in Newsletter folder
        if (picPath == "")
        {
            divError.InnerText = "Please select an image for the newsletter.";
    
        }
        if (newsletterPath == "")
        { divError.InnerText = "Please provide the e-copy of newsletter."; }
    
        else {
            try
            {
                string uploadedBy = Session\["Email"\].ToString();
                if (dl.insertNewsletter(txtTitle.Text, ddlMonth.SelectedItem.ToString(), areaSummery.Text, picPath, newsletterPath, ddlCohort.SelectedItem.ToString(), isBest, uploadedBy)>0)
                {
                    divSuccess.InnerText = "Thanks! Mahara Insight has been uploaded successfully.";
                    divSuccess.Visible = true;
                }
                else
                {
                    divSuccess .InnerText = "Sorry for inconvenience. Some error has occured. Please try later.";
                    divSuccess.Visible = true;
                }
            }
            catch (Exception ex)
            {
                divError.InnerText = "Sorry for inconvenience. Some error has occured. Please try later.";
            }
    
    }
    }
    

    Regar

    Web Development csharp asp-net sysadmin help question

  • Uploaded files are excluded from the folder
    H HumaMunir

    The idea is that the admin will upload the newsletter, that will be shown to every user. This is not something exceptional, I have done this before using file upload. You can upload the files by giving a path and then can store the same path in the database to show them later. But this time all the uploaded files are invisible,in other words, are not included in my asp.net project's folder.

    Regards HumaMunir

    Web Development csharp asp-net sysadmin help question

  • Uploaded files are excluded from the folder
    H HumaMunir

    Hello Everyone, I am uploading an image file using asp file upload control. This is my code to upload the file in the folder.

    public string UploadPicture()
    {
    if(fuImage.HasFile )
    try
    {

             fuImage.SaveAs(Server.MapPath("~/assets/ImgNewsletter/") + fuImage.FileName );
             string imagePath = "~/assets/ImgNewsletter/" + fuImage.FileName;
             return imagePath;
         }
         catch (Exception ex)
         {
             return "";
         }
     return "";
     }
    

    and I have added this in my web.config

    My problem is that even after the files are uploaded, they are excluded from my ASP.Net project. Kindly let me know whats wrong with my code? Many Thanks,

    Regards HumaMunir

    Web Development csharp asp-net sysadmin help question
  • Login

  • Don't have an account? Register

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