Click here to Skip to main content
11,483,983 members (65,656 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
hi..
I have a page on which i am using file upload control to save image and on another page i want to retrieve the image.
to save data i used the code
if (FileUpload1.HasFile)
{
   try
   {
      bool isValidType = false;
      string filename = FileUpload1.PostedFile.FileName;
      string[] validext = { "pdf", "doc", "docx"};
      string ext = System.IO.Path.GetExtension(FileUpload1.FileName);
      for (int i = 0; i < validext.Length; i++)
      {
         if (ext == "." + validext[i])
         {
            isValidType = true;
            break;
         }
      }
      if (!isValidType)
      {
         lblmessage.Text = "pdf, doc, docx Files are allowed";
 
      }
      else
      {
         FileUpload1.SaveAs(Server.MapPath("~/Resume") + filename);
         _zeumay.cv_uploaded_url = "~/Resume/" + filename;//Path Of the Uploaded Cv
      }
   }
Is there any mistake in this.?
and also ell me how to retrieve image in image control in other page.?

[edit]code block added and indexation corrected[/edit]
Posted 16-Nov-12 20:08pm
Edited 17-Nov-12 3:03am
Nelek70.7K
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

HI use Server.Mappath

Try This
_zeumay.cv_uploaded_url =Server.Mappath("~")+"/Resume/" + filename;//Path Of the Uploaded Cv
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 210
1 Frankie-C 165
2 Raje_ 155
3 OriginalGriff 142
4 Abhipal Singh 108
0 Sergey Alexandrovich Kryukov 8,489
1 OriginalGriff 7,943
2 Sascha Lefèvre 3,114
3 Maciej Los 2,581
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 17 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100