Files Not found error when running on web Application
-
Hi all im trying to write a file to a database(stored as image), my program works fine in debug mode, and my file name is c:\\Test\\Test.jpg(contained in tboPath.Text) When i run the application as an actual webpage from the server i get the error message "c:TestTest.jpg file name not found", even though the file is there. does anyone know whats causing this. SqlParameter imgLogo = new SqlParameter("@LogoImage", SqlDbType.Image); imgLogo.Direction = ParameterDirection.Input; if (tboPath.Text != "") { imgLogo.Value = File.ReadAllBytes(tboPath.Text); SqlCmd.Parameters.Add(imgLogo); CheckImageExist(strFileName); } Thank you
-
Hi all im trying to write a file to a database(stored as image), my program works fine in debug mode, and my file name is c:\\Test\\Test.jpg(contained in tboPath.Text) When i run the application as an actual webpage from the server i get the error message "c:TestTest.jpg file name not found", even though the file is there. does anyone know whats causing this. SqlParameter imgLogo = new SqlParameter("@LogoImage", SqlDbType.Image); imgLogo.Direction = ParameterDirection.Input; if (tboPath.Text != "") { imgLogo.Value = File.ReadAllBytes(tboPath.Text); SqlCmd.Parameters.Add(imgLogo); CheckImageExist(strFileName); } Thank you
omlac wrote:
i get the error message "c:TestTest.jpg file name not found
Did you mean to forget the slashes, or was that exactly what the error message said? Also remember that on the server the web application runs on the server. If this directory exists on the client (the machine your browser is on) then the web application cannot access it.
* Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
-
Hi all im trying to write a file to a database(stored as image), my program works fine in debug mode, and my file name is c:\\Test\\Test.jpg(contained in tboPath.Text) When i run the application as an actual webpage from the server i get the error message "c:TestTest.jpg file name not found", even though the file is there. does anyone know whats causing this. SqlParameter imgLogo = new SqlParameter("@LogoImage", SqlDbType.Image); imgLogo.Direction = ParameterDirection.Input; if (tboPath.Text != "") { imgLogo.Value = File.ReadAllBytes(tboPath.Text); SqlCmd.Parameters.Add(imgLogo); CheckImageExist(strFileName); } Thank you
Thank you very much for your response. 1. There is no such folder on the server, but im getting the file from my machine(the one im running from). Would you know how im must write the path so that its read even if im not running in debug. 2.im using javascript to display error messages so thats why c:testtest.pgn- at first i was thinking running on the server removes the backslashes. Thank you very much.