TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Darpan Pathak
NA
8
4.8k
image upload
Nov 26 2012 10:32 AM
I am using a code to upload and save images into database and folder. Its works on localhost but when i uploded this forms on server its not working and giving 404 error. here is the link image.redmelonz.com i am using following code protected void btnSubmit_Click(object sender, EventArgs e) { //Get Filename from fileupload control string filename = Path.GetFileName(fileuploadimages.PostedFile.FileName); //Save images into Images folder fileuploadimages.SaveAs(Server.MapPath("~/Images/"+filename)); //Getting dbconnection from web.config connectionstring //Open the database connection con.Open(); //Query to insert images path and name into database SqlCommand cmd = new SqlCommand("Insert into ImagesPath(ImageName,ImagePath) values(@ImageName,@ImagePath)", con); //Passing parameters to query cmd.Parameters.AddWithValue("@ImageName", filename); cmd.Parameters.AddWithValue("@ImagePath", "~/Images/" + filename); cmd.ExecuteNonQuery(); //Close dbconnection con.Close(); Response.Redirect("~/Default.aspx"); }
Reply
Answers (
2
)
create Stored Procedure in SQL
Display duplicate rows in a table