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
أماني مفيد
NA
142
17.3k
upload image working in localhost , but on server not
Sep 10 2020 2:07 AM
I have a site with upload image, on localhost working, but when I deploy it to server not working give me this error
Error! Object reference not set to an instance of an object
this is the method,
public
string
Createcontant(
string
articalname,
string
KEYWORD_NAME,
string
articalbody , HttpPostedFileBase file)
{
Contant c1 =
new
Contant() ;
OracleConnection conn =
new
OracleConnection();
OracleCommand cmd =
new
OracleCommand();
int
MaxContentLength = 1024 * 1024 * 3;
//3 MB
string
[] AllowedFileExtensions =
new
string
[] {
".jpg"
,
".gif"
,
".png"
,
".pdf"
};
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(HttpContext.Current.Server.MapPath(
"~/Images"
), fileName);
file.SaveAs(path);
try
{
conn.ConnectionString = ConfigurationManager.ConnectionStrings[
"ConnString"
].ConnectionString;
cmd.Connection = conn;
conn.Open();
cmd.Parameters.AddWithValue(
"photo"
, fileName);
cmd.Parameters.AddWithValue(
"articalname"
, articalname);
cmd.Parameters.AddWithValue(
"KEYWORD_NAME"
, KEYWORD_NAME);
cmd.Parameters.AddWithValue(
"articalbody"
, articalbody);
cmd.Parameters.AddWithValue(
"parAddedUser"
, HttpContext.Current.Session[
"UserName"
].ToString());
cmd.Parameters.AddWithValue(
"articalbody"
, articalbody);
string
sql =
"insert into contact"
+
"( ARTICL_ID, ARTICAL_NAME, IDATE, IUSER,"
+
" KEYWORD_NAME, ARTICALBODY ,photo )"
+
" Values "
+
"( CONTANT_SEQ.nextval, :articalname,sysdate,:parAddedUser,"
+
" :KEYWORD_NAME,:articalbody , :photo)"
;
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
cmd.Dispose();
cmd.Parameters.Clear();
return
"done"
;
}
where is the problem?
Reply
Answers (
2
)
How do I add a a dropdown menu in the default asp .net 3.1 razor templ
Could not load file or assembly 'Microsoft.Office.Interop.Excel