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. I want to upload image on the site.

I want to upload image on the site.

Scheduled Pinned Locked Moved ASP.NET
questionsysadminhelp
8 Posts 3 Posters 1 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.
  • C Offline
    C Offline
    Chetan Ranpariya
    wrote on last edited by
    #1

    I have a web application, in this application, i am browsing the image path on the clinet machine and those image can be uploaded on the server. But, this system is working well on the local machine, but it can't be working on internet. So plese what is the problem?

    P 1 Reply Last reply
    0
    • C Chetan Ranpariya

      I have a web application, in this application, i am browsing the image path on the clinet machine and those image can be uploaded on the server. But, this system is working well on the local machine, but it can't be working on internet. So plese what is the problem?

      P Offline
      P Offline
      Paddy Boyd
      wrote on last edited by
      #2

      What's the error message?

      C 1 Reply Last reply
      0
      • P Paddy Boyd

        What's the error message?

        C Offline
        C Offline
        Chetan Ranpariya
        wrote on last edited by
        #3

        Hi, Thank you for the reply. I am get the FileNotFoundException and error message is File Could not be find. Thanks Chetan Ranpariya

        P 1 Reply Last reply
        0
        • C Chetan Ranpariya

          Hi, Thank you for the reply. I am get the FileNotFoundException and error message is File Could not be find. Thanks Chetan Ranpariya

          P Offline
          P Offline
          Paddy Boyd
          wrote on last edited by
          #4

          Are you sure that you are getting the file uploaded properly? How are you uploading/saving?

          C 1 Reply Last reply
          0
          • P Paddy Boyd

            Are you sure that you are getting the file uploaded properly? How are you uploading/saving?

            C Offline
            C Offline
            Chetan Ranpariya
            wrote on last edited by
            #5

            Hi, To select File I am using HTML's File input control. Path of selected file is pushed in to a TextBox. I am creating FileInfo object for the file path that I get in the textbox and then use Copy Method to copy that file on server. FileInfo fUpload = new FileInfo(txtFilePath.Text); //Exception Occurs Here string strDestPath = MapPath("../Files/" + fUpload.Name); fUpload.CopyTo(strDestPath,true); I get the Exception in the first line of code. Should I make the html file control server control and user its PostedFile.SaveAs method to copy the file instead of using textbox? Thanks and Regards, Chetan Ranpariya.

            P J 2 Replies Last reply
            0
            • C Chetan Ranpariya

              Hi, To select File I am using HTML's File input control. Path of selected file is pushed in to a TextBox. I am creating FileInfo object for the file path that I get in the textbox and then use Copy Method to copy that file on server. FileInfo fUpload = new FileInfo(txtFilePath.Text); //Exception Occurs Here string strDestPath = MapPath("../Files/" + fUpload.Name); fUpload.CopyTo(strDestPath,true); I get the Exception in the first line of code. Should I make the html file control server control and user its PostedFile.SaveAs method to copy the file instead of using textbox? Thanks and Regards, Chetan Ranpariya.

              P Offline
              P Offline
              Paddy Boyd
              wrote on last edited by
              #6

              You're posting back to the server and then trying to select a path on the client's machine, which is why you're getting an error. Try looking at this.

              1 Reply Last reply
              0
              • C Chetan Ranpariya

                Hi, To select File I am using HTML's File input control. Path of selected file is pushed in to a TextBox. I am creating FileInfo object for the file path that I get in the textbox and then use Copy Method to copy that file on server. FileInfo fUpload = new FileInfo(txtFilePath.Text); //Exception Occurs Here string strDestPath = MapPath("../Files/" + fUpload.Name); fUpload.CopyTo(strDestPath,true); I get the Exception in the first line of code. Should I make the html file control server control and user its PostedFile.SaveAs method to copy the file instead of using textbox? Thanks and Regards, Chetan Ranpariya.

                J Offline
                J Offline
                J4amieC
                wrote on last edited by
                #7

                Chetan Ranpariya wrote:

                Should I make the html file control server control and user its PostedFile.SaveAs method to copy the file instead of using textbox?

                Yes! That is what it is for. What you have tried to do will never work because the path is on the client, and you're created FileInfo instance is on the server. Current blacklist svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour

                C 1 Reply Last reply
                0
                • J J4amieC

                  Chetan Ranpariya wrote:

                  Should I make the html file control server control and user its PostedFile.SaveAs method to copy the file instead of using textbox?

                  Yes! That is what it is for. What you have tried to do will never work because the path is on the client, and you're created FileInfo instance is on the server. Current blacklist svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour

                  C Offline
                  C Offline
                  Chetan Ranpariya
                  wrote on last edited by
                  #8

                  Hi, Thanks for the sugession. The way u suggest worked finely. Now my problem has been solved. Thanks to all the others who gave me their views. Chetan Ranpariya.

                  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