How to bulk insert because file 'C:\Inetpub\wwwroot\Webfile1\Data\upload.txt' ....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dougancil
    Contributor
    • Apr 2010
    • 347

    How to bulk insert because file 'C:\Inetpub\wwwroot\Webfile1\Data\upload.txt' ....

    I have a web page written in asp.net that is basically an upload button that does a bulk insert into a sql table.

    When a user presses an upload button, a .txt file is uploaded to a directory on the web server, and also inserted into a sql server on my network. I can get the file to upload to the correct destination but when the server tries to bulk insert to the database I get the following error:

    Could not bulk insert because file 'C:\Inetpub\www root\Webfile1\D ata\upload.txt' could not be opened. Operating system error code 3

    I have attempted to use UNC for the path for the file, but as the file is being uploaded in the first place, that doesnt seem like the problem. I also modified the machine.config on the web server to have the asp.net instance log in as the administrator on the web server, the permissions of the Data directory is set to everyone to have admin rights to that folder. On the sql server, bulk administer permissions are enabled and there are no contraints for triggers or keeping identity. Can anyone please help me understand why this isnt working?

    Thank you,

    Doug
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    The file is on your client side. Search for some free script on how to upload file to an ftp server and subsequently upload it to your SQL Server.

    Happy Coding!!!

    ~~ CK

    Comment

    Working...