Log in

View Full Version : Remote retrieval & upload module for (BLOB)



dimmemo
07-04-2008, 01:43 AM
hi i am doing an remote retrieval and upload of image on my webportal using MS SQL database server and Visual Studio 2005 C#.. when i try upload a new image after i press the browse button to select a new image...i press the "save new changes" button.. it bring me to the confirm page.. inside the page, it should come out the new image i been uploaded.. but i only see an unavailable image. but the strange thing is the new image been uploaded.. i can able to view the new image on one of the selected page call partners.aspx.. the image been able to view on the page.


eg. photobucket,, u wanna upload a new image on ur profile..after u uploaded the new image.. u will come to a page whether u wanna confirm that image... my problem is this ... i come to the confirm page... by right it should display the image.. but i cant... i can only able to view the display image after i confirmed the new image been uploaded.


protected void BTNSave_Click(object sender, EventArgs e)
{
// Set a specified View to display
MVEditCompanyDetails.SetActiveView(ViewConfirmCompanyDetails);

companyname = (string)Session["companyname"];
if (FileUploadCompanyLogo1.HasFile)
{
// Write the logo to the confirmation company logo image control
FileStream fsread = new FileStream(FileUploadCompanyLogo1.PostedFile.FileName.ToString(), FileMode.Open, FileAccess.Read);
FileStream fswrite = new FileStream(ConfigurationManager.AppSettings["LoginLogoPath"] + "temp" + companyname + ".jpg", FileMode.Create);

// Create the writer for data.
BinaryReader logoread = new BinaryReader(fsread);
BinaryWriter logowrite = new BinaryWriter(fswrite);

logowrite.Write(logoread.ReadBytes(FileUploadCompanyLogo1.PostedFile.ContentLength));

logoread.Close();
logowrite.Close();
fsread.Close();
fswrite.Close();

// Reference IMGComLogo to the path of the image
IMGComLogo.ImageUrl = "../" + ConfigurationManager.AppSettings["ImageLoginLogoPath"] + "temp" + companyname + ".jpg";
Session.Add("mainpath", companyname + ".jpg");
Session.Add("path", "temp" + companyname + ".jpg");
}

else
{
IMGComLogo.ImageUrl = IMGCompanyLogo.ImageUrl;
Session.Add("path", companyname + ".jpg");
}

Session.Add("fileUpload", FileUploadCompanyLogo1);

LBLComName.Text = LBLCompanyName.Text;
LBLDescription.Text = TBDescription.Text;
LBLProducts.Text = TBProducts.Text;
LBLContactPerson.Text = TBContactPerson.Text;
LBLDesignation.Text = TBDesignation.Text;
LBLTelephone.Text = TBTelephone.Text;
LBLFax.Text = TBFax.Text;
LBLEmail.Text = TBEmail.Text;
LBLWebsite.Text = TBWebsite.Text;
}