Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to attach file from network drives

how to attach file from network drives

Scheduled Pinned Locked Moved ASP.NET
htmlsysadmintutorial
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kpsetty
    wrote on last edited by
    #1

    hi friends, i am using HTML FileField to pick a file for attachment.to pick a file i am using this code "btn_FileField.PostedFile.FileName", but it is working when picking file from local drives, and it is not working when pick a file from network mapped drives, is anybody having solutions.

    G S 2 Replies Last reply
    0
    • K kpsetty

      hi friends, i am using HTML FileField to pick a file for attachment.to pick a file i am using this code "btn_FileField.PostedFile.FileName", but it is working when picking file from local drives, and it is not working when pick a file from network mapped drives, is anybody having solutions.

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Standard question #1: What do you mean by "not working"? --- b { font-weight: normal; }

      K 1 Reply Last reply
      0
      • G Guffa

        Standard question #1: What do you mean by "not working"? --- b { font-weight: normal; }

        K Offline
        K Offline
        kpsetty
        wrote on last edited by
        #3

        hi guffa, if i pick a file(using HTML FileField) from network drives(i.e., another system from my Local Area Netowrk or from the server) then the following error occurs. Error: ===== Couldnot find part of the path"K:\aa\bb.doc".

        G 1 Reply Last reply
        0
        • K kpsetty

          hi guffa, if i pick a file(using HTML FileField) from network drives(i.e., another system from my Local Area Netowrk or from the server) then the following error occurs. Error: ===== Couldnot find part of the path"K:\aa\bb.doc".

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Are you trying to access the file from the server code? A FileField is not used to select a file, it's used to upload a file. Get the uploaded file from the PostedFile property. --- b { font-weight: normal; }

          1 Reply Last reply
          0
          • K kpsetty

            hi friends, i am using HTML FileField to pick a file for attachment.to pick a file i am using this code "btn_FileField.PostedFile.FileName", but it is working when picking file from local drives, and it is not working when pick a file from network mapped drives, is anybody having solutions.

            S Offline
            S Offline
            SABhatti
            wrote on last edited by
            #5

            First upload the file to server in any folder, then use it as attachement, send the email and delete the file from the server after sending email.. Salim Akbar

            K 1 Reply Last reply
            0
            • S SABhatti

              First upload the file to server in any folder, then use it as attachement, send the email and delete the file from the server after sending email.. Salim Akbar

              K Offline
              K Offline
              kpsetty
              wrote on last edited by
              #6

              dear salim, actually i can be able to attach and upload the file to sql server only form my local drives (C:, D:)etc., bu i can't be able to pick and upload the files from the another computers available in my Local Area Network.

              S 1 Reply Last reply
              0
              • K kpsetty

                dear salim, actually i can be able to attach and upload the file to sql server only form my local drives (C:, D:)etc., bu i can't be able to pick and upload the files from the another computers available in my Local Area Network.

                S Offline
                S Offline
                SABhatti
                wrote on last edited by
                #7

                Well, can you paste the part of code that you are using to upload. The following code just works fine to upload fiels from the network. Dim myFile As HttpPostedFile = getFile.PostedFile If IsNothing(myFile) Then lbl.Text = "please select a file to opload" : Exit Sub If myFile.ContentLength = 0 Then lbl.Text = "cannot upload zero length file" : Exit Sub Dim fileN As String = IO.Path.GetFileName(getFile.PostedFile.FileName) myFile.SaveAs(server.mappath("/upload") & fileN) lbl.Text = "i got it " where getFile is the HTML file field... Salim Akbar

                K 1 Reply Last reply
                0
                • S SABhatti

                  Well, can you paste the part of code that you are using to upload. The following code just works fine to upload fiels from the network. Dim myFile As HttpPostedFile = getFile.PostedFile If IsNothing(myFile) Then lbl.Text = "please select a file to opload" : Exit Sub If myFile.ContentLength = 0 Then lbl.Text = "cannot upload zero length file" : Exit Sub Dim fileN As String = IO.Path.GetFileName(getFile.PostedFile.FileName) myFile.SaveAs(server.mappath("/upload") & fileN) lbl.Text = "i got it " where getFile is the HTML file field... Salim Akbar

                  K Offline
                  K Offline
                  kpsetty
                  wrote on last edited by
                  #8

                  dear salim, i used the code "getfile.postedfile.Filename" but it throws the error, eventhough i tried ur code "IO.Path.GetFileName(getFile.PostedFile.FileName)" but it returns only the filename and not along with the path.i hope u got my question correctly.for ur reference once again i explain. problem: ======== In my local Area Network there are 5 computers and one server.Everybody have right to access(Read,Write,Delete) a folder which is in the server.i am making web application.in my application i am using HTML file field for attaching file.If i pick a file from the server's accessible folder then it will throw an exception "Could not find part of the filename".but if i select a file from my local harddrives then it works without any problem.

                  S 1 Reply Last reply
                  0
                  • K kpsetty

                    dear salim, i used the code "getfile.postedfile.Filename" but it throws the error, eventhough i tried ur code "IO.Path.GetFileName(getFile.PostedFile.FileName)" but it returns only the filename and not along with the path.i hope u got my question correctly.for ur reference once again i explain. problem: ======== In my local Area Network there are 5 computers and one server.Everybody have right to access(Read,Write,Delete) a folder which is in the server.i am making web application.in my application i am using HTML file field for attaching file.If i pick a file from the server's accessible folder then it will throw an exception "Could not find part of the filename".but if i select a file from my local harddrives then it works without any problem.

                    S Offline
                    S Offline
                    SABhatti
                    wrote on last edited by
                    #9

                    you said i used the code "getfile.postedfile.Filename" you should get the file like this Dim myFile As HttpPostedFile = getFile.PostedFile remove filename... Salim Akbar

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups