Click here to Skip to main content
15,886,067 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Uploaded files are excluded from the folder Pin
HumaMunir11-Jun-14 23:09
HumaMunir11-Jun-14 23:09 
GeneralRe: Uploaded files are excluded from the folder Pin
Richard MacCutchan12-Jun-14 0:34
mveRichard MacCutchan12-Jun-14 0:34 
GeneralRe: Uploaded files are excluded from the folder Pin
jinzai16-Jul-14 23:46
jinzai16-Jul-14 23:46 
AnswerRe: Uploaded files are excluded from the folder Pin
Kornfeld Eliyahu Peter11-Jun-14 23:07
professionalKornfeld Eliyahu Peter11-Jun-14 23:07 
GeneralRe: Uploaded files are excluded from the folder Pin
HumaMunir11-Jun-14 23:24
HumaMunir11-Jun-14 23:24 
AnswerRe: Uploaded files are excluded from the folder Pin
Kornfeld Eliyahu Peter11-Jun-14 23:57
professionalKornfeld Eliyahu Peter11-Jun-14 23:57 
AnswerRe: Uploaded files are excluded from the folder Pin
Bernhard Hiller11-Jun-14 20:55
Bernhard Hiller11-Jun-14 20:55 
GeneralRe: Uploaded files are excluded from the folder Pin
HumaMunir11-Jun-14 23:03
HumaMunir11-Jun-14 23:03 
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.

C#
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.";
            }

    }
    }

Regards

HumaMunir

QuestionHow third party templates can help in developing new application Pin
Rishihar Subashchandran9-Jun-14 23:48
professionalRishihar Subashchandran9-Jun-14 23:48 
AnswerRe: How third party templates can help in developing new application Pin
Kornfeld Eliyahu Peter10-Jun-14 0:04
professionalKornfeld Eliyahu Peter10-Jun-14 0:04 
GeneralRe: How third party templates can help in developing new application Pin
Rishihar Subashchandran10-Jun-14 17:32
professionalRishihar Subashchandran10-Jun-14 17:32 
AnswerRe: How third party templates can help in developing new application Pin
jinzai17-Jul-14 0:28
jinzai17-Jul-14 0:28 
Questioninline editing in a gridview in asp.net mvc web application Pin
Member 108357177-Jun-14 16:21
Member 108357177-Jun-14 16:21 
QuestionGEO-FENCING Pin
pawan sen 1039801030-May-14 20:35
professionalpawan sen 1039801030-May-14 20:35 
QuestionRe: GEO-FENCING Pin
ZurdoDev4-Jun-14 5:32
professionalZurdoDev4-Jun-14 5:32 
AnswerRe: GEO-FENCING Pin
Member 108647234-Jun-14 9:34
Member 108647234-Jun-14 9:34 
SuggestionRe: GEO-FENCING Pin
Richard Deeming5-Jun-14 6:42
mveRichard Deeming5-Jun-14 6:42 
QuestionApache to Tomcat to Apache to cgi per transaction accounting Pin
Ernst Iliov Stavro Blofeld29-May-14 11:11
Ernst Iliov Stavro Blofeld29-May-14 11:11 
QuestionNewbie question about centering text in a header that has an image Pin
Max Huerta28-May-14 5:48
Max Huerta28-May-14 5:48 
QuestionUpdate existing desktop C# application as a webservice Pin
aks.25-May-14 23:32
aks.25-May-14 23:32 
AnswerRe: Update existing desktop C# application as a webservice Pin
Kornfeld Eliyahu Peter26-May-14 0:18
professionalKornfeld Eliyahu Peter26-May-14 0:18 
QuestionCookie Specifics Pin
Richard Andrew x6425-May-14 18:53
professionalRichard Andrew x6425-May-14 18:53 
AnswerRe: Cookie Specifics Pin
Kornfeld Eliyahu Peter25-May-14 20:20
professionalKornfeld Eliyahu Peter25-May-14 20:20 
QuestionCompress a whole folder and all its content on a remote FTP Server with PHP Pin
GoogleBoss24-May-14 2:46
GoogleBoss24-May-14 2:46 
QuestionHow was this page built? Pin
Wombaticus21-May-14 2:51
Wombaticus21-May-14 2:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.