Click here to Skip to main content
15,922,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to store image into the folder and store its path into the databae using asp.net with vb.net
Posted
Comments
Rajesh Anuhya 8-Feb-11 0:00am    
No Effort

Hi Varsha,

Please try following

C#
string fileName = Path.GetFileName(this.FileUpload1.PostedFile.FileName);
if (!File.Exists("Images/"+ fileName))
{
    //Save Uploaded file at Images folder
    FileUpload1.SaveAs(Path.Combine(PDFAttachmentFolderPath, fileName));
 
    //Here is code for save file name in Database
    //You can use fileName variable to get uploaded recently image name. 
}


Thanks,
Imdadhusen
 
Share this answer
 
Comments
varsha p 8-Feb-11 0:14am    
but in your code some error occurs
string fileName = Path.GetFileName(this.FileUpload1.PostedFile.FileName);
if (!File.Exists("Images/"+ fileName))
{
//Save Uploaded file at Images folder
FileUpload1.SaveAs(Path.Combine(PDFAttachmentFolderPath, fileName));

//Here is code for save file name in Database
//You can use fileName variable to get uploaded recently image name.
}


in above code error in the path.getfile statement error is any imports is needed for that
check here[^]
Its in c# converting to vb should not be a problem.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900