Error Uploading! please help.
-
I have been trying all day to upload text file to server but I have this error. Is something wrong? Anybody who know how to solve this problem please help me out. ================================================================================================ Server Error in '/' Application. -------------------------------------------------------------------------------- Could not find a part of the path 'D:\webhost\TextFiles\mydata.txt'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\webhost\TextFiles\mydata.txt'. Source Error: Line 75: { Line 76: fileName = Server.MapPath("//TextFiles//mydata.txt"); Line 77: FileUpload.PostedFile.SaveAs(Server.MapPath("//TextFiles//mydata.txt")); Line 78: input = ""; Line 79: Source File: d:\webhost\471463016\Index.aspx Line: 77 ================================================================================================== Thank you so very much,
junior boy
-
I have been trying all day to upload text file to server but I have this error. Is something wrong? Anybody who know how to solve this problem please help me out. ================================================================================================ Server Error in '/' Application. -------------------------------------------------------------------------------- Could not find a part of the path 'D:\webhost\TextFiles\mydata.txt'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\webhost\TextFiles\mydata.txt'. Source Error: Line 75: { Line 76: fileName = Server.MapPath("//TextFiles//mydata.txt"); Line 77: FileUpload.PostedFile.SaveAs(Server.MapPath("//TextFiles//mydata.txt")); Line 78: input = ""; Line 79: Source File: d:\webhost\471463016\Index.aspx Line: 77 ================================================================================================== Thank you so very much,
junior boy
Cunningly enough, the exception tells you what is wrong. The path D:\webhost\textfiles\ isn't valid. I'm going to guess here that the TextFiles directory isn't present at this location.
Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.
-
I have been trying all day to upload text file to server but I have this error. Is something wrong? Anybody who know how to solve this problem please help me out. ================================================================================================ Server Error in '/' Application. -------------------------------------------------------------------------------- Could not find a part of the path 'D:\webhost\TextFiles\mydata.txt'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\webhost\TextFiles\mydata.txt'. Source Error: Line 75: { Line 76: fileName = Server.MapPath("//TextFiles//mydata.txt"); Line 77: FileUpload.PostedFile.SaveAs(Server.MapPath("//TextFiles//mydata.txt")); Line 78: input = ""; Line 79: Source File: d:\webhost\471463016\Index.aspx Line: 77 ================================================================================================== Thank you so very much,
junior boy
I think you are not providing the proper path Are you sure TextFiles folder exist in your application
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
I think you are not providing the proper path Are you sure TextFiles folder exist in your application
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
I tried to run on localhost on my computer it work fine but it didn't work on my server. I'm not sure how to coding for proper path on the server please see. FileUpload.PostedFile.SaveAs(Server.MapPath("TextFiles//mydata.txt")); //Is this right? If I have my webhost like this ftp://webhost.example.com/... <-- and I put all file and folder here. And i'm sure I the TextFiles folder is existed. Thank you million sir,
junior boy
-
I tried to run on localhost on my computer it work fine but it didn't work on my server. I'm not sure how to coding for proper path on the server please see. FileUpload.PostedFile.SaveAs(Server.MapPath("TextFiles//mydata.txt")); //Is this right? If I have my webhost like this ftp://webhost.example.com/... <-- and I put all file and folder here. And i'm sure I the TextFiles folder is existed. Thank you million sir,
junior boy
OK Can't you access that and see folder exist or not .......... Ok you can do one thing before uploading a file First check the Directory TextFiles exist or not if it not present there create with same name and put your file in that directory What you think my friend ?;)
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
I tried to run on localhost on my computer it work fine but it didn't work on my server. I'm not sure how to coding for proper path on the server please see. FileUpload.PostedFile.SaveAs(Server.MapPath("TextFiles//mydata.txt")); //Is this right? If I have my webhost like this ftp://webhost.example.com/... <-- and I put all file and folder here. And i'm sure I the TextFiles folder is existed. Thank you million sir,
junior boy
The standard way of doing this would be to do the following:
if (!Directory.Exists(Server.MapPath("/TextFiles"))) Directory.Create(Server.MapPath("/TextFiles"));
Then, you can do the save as operation. Note that the asp worker process will need permissions to write into your directory structure to do this.
Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.
-
The standard way of doing this would be to do the following:
if (!Directory.Exists(Server.MapPath("/TextFiles"))) Directory.Create(Server.MapPath("/TextFiles"));
Then, you can do the save as operation. Note that the asp worker process will need permissions to write into your directory structure to do this.
Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.
I am really appreciated all your help sir. I don't get it work yet but I am trying. Thank you for all replied message again sir,
junior boy
-
The standard way of doing this would be to do the following:
if (!Directory.Exists(Server.MapPath("/TextFiles"))) Directory.Create(Server.MapPath("/TextFiles"));
Then, you can do the save as operation. Note that the asp worker process will need permissions to write into your directory structure to do this.
Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.
I have been trying to upload all last night:( please see this code: ================================================================================ string fileName = Server.MapPath("~/471463016/TextFiles/"); if(Directory.Exists(fileName)) Response.Write("Existed"); else { Directory.CreateDirectory(fileName); Response.Write("Not Exist"); } ================================================================================ It shows me message: Existed And then please see code: ================================================================================ Response.Write("Path = "+fileName); try { FileUpload.PostedFile.SaveAs(fileName+"mydata.txt"); } catch(Execption ex){ Response.Write("
Error: " + ex.Message); } ================================================================================ The result : Path = D:\webhost\471463016\TextFiles\ Error: Access to the path 'D:\webhost\471463016\TextFiles\mydata.txt' is denied. I don't really understand why I have the error when it show me the folder path is existed. Believe me, I have been try so hard as i have never tried, I really need help because I have deadline on July 7 Saturday to send my school project,sir. Again, anyhelp will be really appreciated. My email : big_kh@hotmail.com Thank you million,junior boy
-
I have been trying to upload all last night:( please see this code: ================================================================================ string fileName = Server.MapPath("~/471463016/TextFiles/"); if(Directory.Exists(fileName)) Response.Write("Existed"); else { Directory.CreateDirectory(fileName); Response.Write("Not Exist"); } ================================================================================ It shows me message: Existed And then please see code: ================================================================================ Response.Write("Path = "+fileName); try { FileUpload.PostedFile.SaveAs(fileName+"mydata.txt"); } catch(Execption ex){ Response.Write("
Error: " + ex.Message); } ================================================================================ The result : Path = D:\webhost\471463016\TextFiles\ Error: Access to the path 'D:\webhost\471463016\TextFiles\mydata.txt' is denied. I don't really understand why I have the error when it show me the folder path is existed. Believe me, I have been try so hard as i have never tried, I really need help because I have deadline on July 7 Saturday to send my school project,sir. Again, anyhelp will be really appreciated. My email : big_kh@hotmail.com Thank you million,junior boy
Check your permissions. ASP.NET applications run under a special worker process and this process will need permissions to write to the file system.
Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.
-
Check your permissions. ASP.NET applications run under a special worker process and this process will need permissions to write to the file system.
Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.
Thank gosh... Finally my project every thing worked right:) I am really exited and it worthwhile on have been tried hard. Thank you for all help again,sir.:rose::-D If you would like to visit my small project here is the link Click here -- modified at 0:48 Thursday 5th July, 2007
junior boy