locked
Read CSV and Excel File Issue In Server RRS feed

  • Question

  • User1778243854 posted

    I have created a application which reads CSV and Excel from User uploaded file... Its working perfectly on local machine, But when i deployed in server i am unable to read files.... 

    'D:\arrgh\arrgh\Uploads\countrylist.csv' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

    Friday, July 24, 2015 7:05 PM

All replies

  • User409696431 posted

    Is your hosted server path really what you specified?  From the message I assume it is not.  You should not hard code the path name.  Use Server.MapPath("/Uploads")  (assuming the Uploads folder is in the root of your application; adjust the path if it is not) to get the Uploads folder path.

    Saturday, July 25, 2015 12:35 AM
  • User1778243854 posted
    That's a client path
    Saturday, July 25, 2015 9:37 AM
  • User-219423983 posted

    Hi yvdk7788,

    That's a client path

    Do you means 'D:\arrgh\arrgh\Uploads\countrylist.csv' is a client path? If it’s true, I guess maybe you do some actions directly on this path in your code. You’d better first save the uploaded files and then operator them using the server-side’s file path. About why you don’t get the file path, you could refer to the "File Upload Control section" in the following article.

    http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx

    The following link also provides an explanation and give a method to save files to server, you cold take a look.

    http://www.aspsnippets.com/Articles/ASPNet-FileUpload-Control-Get-Full-File-Path.aspx

    I hope it’s useful to you.

    Best Regards,

    Weibo Zhang

    Wednesday, July 29, 2015 12:09 PM