P
Paul Gorman
I am using the control type = file to perform a file
upload. When I click on the browse button to go select
the image I want to upload it places in the text box a
local path (C:\images\image.jpg for example). This is
where the image resides that I want to upload. Then I
proceed to click on upload so that I can run through my
code to do the upload process:
string strConnection = "some connection string";
SqlConnection oCon = new SqlConnection(strConnection);
SqlCommand oCom = new SqlCommand();
oCom.CommandText = "usp_msa_image_save_binary";
oCom.CommandType = CommandType.StoredProcedure;
oCom.Connection = oCon;
oCon.Open();
FileStream fs;
string strFileName = this.loFile.PostedFile.FileName;
fs = File.OpenRead(strFileName);
int intCount = (int)fs.Length;
int intSize;
byte[] buffer = new byte[intCount];
fs.Read(buffer,0,intCount);
oCom.Parameters.Add("@Image", SqlDbType.Image).Value =
buffer;
oCom.Parameters.Add("@itemID", SqlDbType.VarChar,
30).Value = "CEH03BA401"; //Request.QueryString.Get
("name");
if ( this.chkSmallImage.Checked )
{
oCom.Parameters.Add("@size", SqlDbType.Int).Value = 1;
intSize = 1;
}
else
{
oCom.Parameters.Add("@size", SqlDbType.Int).Value = 2;
intSize = 2;
}
oCom.ExecuteNonQuery();
string strItemNumber = Request.QueryString.Get("name");
string strUrl = "image_binary_get.aspx?itemnumber=" +
strItemNumber + "&size=" + intSize;
this.imgView.ImageUrl = strUrl;
It continues to fail at
fs = File.OpenRead(strFileName);
with the error message:
"Could not find part of the path "C:\images\image.jpg".
The one thing that I can be sure of is this. When i
attempt this process on the IIS Server where all this
resides then it works great. As soon as I try to upload
a file from some other computer on the network i get that
error. Any help would be greatly appreciated. Thanks in
advance.
Paul Gorman ><>
upload. When I click on the browse button to go select
the image I want to upload it places in the text box a
local path (C:\images\image.jpg for example). This is
where the image resides that I want to upload. Then I
proceed to click on upload so that I can run through my
code to do the upload process:
string strConnection = "some connection string";
SqlConnection oCon = new SqlConnection(strConnection);
SqlCommand oCom = new SqlCommand();
oCom.CommandText = "usp_msa_image_save_binary";
oCom.CommandType = CommandType.StoredProcedure;
oCom.Connection = oCon;
oCon.Open();
FileStream fs;
string strFileName = this.loFile.PostedFile.FileName;
fs = File.OpenRead(strFileName);
int intCount = (int)fs.Length;
int intSize;
byte[] buffer = new byte[intCount];
fs.Read(buffer,0,intCount);
oCom.Parameters.Add("@Image", SqlDbType.Image).Value =
buffer;
oCom.Parameters.Add("@itemID", SqlDbType.VarChar,
30).Value = "CEH03BA401"; //Request.QueryString.Get
("name");
if ( this.chkSmallImage.Checked )
{
oCom.Parameters.Add("@size", SqlDbType.Int).Value = 1;
intSize = 1;
}
else
{
oCom.Parameters.Add("@size", SqlDbType.Int).Value = 2;
intSize = 2;
}
oCom.ExecuteNonQuery();
string strItemNumber = Request.QueryString.Get("name");
string strUrl = "image_binary_get.aspx?itemnumber=" +
strItemNumber + "&size=" + intSize;
this.imgView.ImageUrl = strUrl;
It continues to fail at
fs = File.OpenRead(strFileName);
with the error message:
"Could not find part of the path "C:\images\image.jpg".
The one thing that I can be sure of is this. When i
attempt this process on the IIS Server where all this
resides then it works great. As soon as I try to upload
a file from some other computer on the network i get that
error. Any help would be greatly appreciated. Thanks in
advance.
Paul Gorman ><>