Moving client fiile to server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Don

    Moving client fiile to server

    I'm trying to setup Javascript running in a browser window that, via
    <input type="file"...> , will pickup a client file and then transfer it
    to my space on the internet host I use. How do I go about doing
    this?

    Thanks,
    Don


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  • Joakim Braun

    #2
    Re: Moving client fiile to server

    "Don" <no@adr.com> skrev i meddelandet
    news:acvnj0d575 lnqenq5fee5r501 g7fqek3qc@4ax.c om...[color=blue]
    > I'm trying to setup Javascript running in a browser window that, via
    > <input type="file"...> , will pickup a client file and then transfer it
    > to my space on the internet host I use. How do I go about doing
    > this?[/color]

    You submit the form like any other form. Server-side, you write a few lines
    of script in your environment of choice that get called by the server when
    the upload is completed. The path to the uploaded file will be provided by
    the script environment. At least that's how it works with PHP.

    Joakim Braun


    Comment

    • Don

      #3
      Re: Moving client fiile to server

      Thanks. But, can you show me some sample code. I'm having a lot of
      trouble with this, and haven't done a whole lot of script coding.

      Thanks, Don


      On Mon, 6 Sep 2004 08:42:40 +0200, "Joakim Braun"
      <joakim.braun@j fbraun.removeth is.com> wrote:
      [color=blue]
      >"Don" <no@adr.com> skrev i meddelandet
      >news:acvnj0d57 5lnqenq5fee5r50 1g7fqek3qc@4ax. com...[color=green]
      >> I'm trying to setup Javascript running in a browser window that, via
      >> <input type="file"...> , will pickup a client file and then transfer it
      >> to my space on the internet host I use. How do I go about doing
      >> this?[/color]
      >
      >You submit the form like any other form. Server-side, you write a few lines
      >of script in your environment of choice that get called by the server when
      >the upload is completed. The path to the uploaded file will be provided by
      >the script environment. At least that's how it works with PHP.
      >
      >Joakim Braun
      >[/color]



      -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
      http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
      -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

      Comment

      • Michael Winter

        #4
        Re: Moving client fiile to server

        On Mon, 06 Sep 2004 00:07:26 -0700, Don <no@adr.com> wrote:
        [color=blue]
        > Thanks. But, can you show me some sample code. I'm having a lot of
        > trouble with this, and haven't done a whole lot of script coding.[/color]

        This isn't a Javascript question, so I'm afraid it's not appropriate for
        this group. You'll need to find out what server-side languages your host
        supports and go to the relevant newsgroup. I expect you'll be able to
        Google for the code, too.

        [snip]

        Good luck,
        Mike

        --
        Michael Winter
        Replace ".invalid" with ".uk" to reply by e-mail.

        Comment

        • Don

          #5
          Re: Moving client fiile to server

          Thanks guys.
          Don


          On Sun, 05 Sep 2004 23:09:55 -0700, Don <no@adr.com> wrote:
          [color=blue]
          >I'm trying to setup Javascript running in a browser window that, via
          ><input type="file"...> , will pickup a client file and then transfer it
          >to my space on the internet host I use. How do I go about doing
          >this?
          >
          >Thanks,
          >Don
          >
          >
          >-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
          >http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
          >-----== Over 100,000 Newsgroups - 19 Different Servers! =-----[/color]



          -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
          http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
          -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

          Comment

          • Joakim Braun

            #6
            Re: Moving client fiile to server

            "Don" <no@adr.com> skrev i meddelandet
            news:433oj01518 lka71l7q1kc25f3 r7fer6odl@4ax.c om...[color=blue]
            > Thanks. But, can you show me some sample code. I'm having a lot of
            > trouble with this, and haven't done a whole lot of script coding.
            >
            > Thanks, Don[/color]

            From the "Handling file uploads" section of the PHP manual (www.php.net).

            <?php
            $uploaddir = '/var/www/uploads/';
            $uploadfile = $uploaddir . $_FILES['userfile']['name'];

            print "<pre>";
            if (move_uploaded_ file($_FILES['userfile']['tmp_name'], $uploadfile)) {
            print "File is valid, and was successfully uploaded. ";
            print "Here's some more debugging info:\n";
            print_r($_FILES );
            } else {
            print "Possible file upload attack! Here's some debugging info:\n";
            print_r($_FILES );
            }
            print "</pre>";

            ?>

            This is the server-side PHP code stored in (for instance) a page that is the
            file upload form's action.

            Joakim Braun


            Comment

            • Colin McKinnon

              #7
              Re: Moving client fiile to server

              Joakim Braun spilled the following:
              [color=blue]
              > "Don" <no@adr.com> skrev i meddelandet
              > news:acvnj0d575 lnqenq5fee5r501 g7fqek3qc@4ax.c om...[color=green]
              >> I'm trying to setup Javascript running in a browser window that, via
              >> <input type="file"...> , will pickup a client file and then transfer it
              >> to my space on the internet host I use. How do I go about doing
              >> this?[/color]
              >
              > You submit the form like any other form. Server-side, you write a few
              > lines of script in your environment of choice that get called by the
              > server when the upload is completed. The path to the uploaded file will be
              > provided by the script environment. At least that's how it works with PHP.
              >[/color]

              One thing to watch out for is that you must specify the encoding type for
              the form (which I always forget):

              <form enctype="multip art/form-data" action="somescr ipt.php" method="post">
              ....

              HTH

              C.

              Comment

              • Don

                #8
                Re: Moving client fiile to server

                Thanks everyone. I really appreciate your help.
                Don


                On Sun, 05 Sep 2004 23:09:55 -0700, Don <no@adr.com> wrote:
                [color=blue]
                >I'm trying to setup Javascript running in a browser window that, via
                ><input type="file"...> , will pickup a client file and then transfer it
                >to my space on the internet host I use. How do I go about doing
                >this?
                >
                >Thanks,
                >Don
                >
                >
                >-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
                >http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
                >-----== Over 100,000 Newsgroups - 19 Different Servers! =-----[/color]



                -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
                http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
                -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

                Comment

                • Don

                  #9
                  Re: Moving client fiile to server

                  On Mon, 6 Sep 2004 23:09:09 +0200, "Joakim Braun"
                  <joakim.braun@j fbraun.removeth is.com> wrote:
                  [color=blue]
                  >"Don" <no@adr.com> skrev i meddelandet
                  >news:433oj0151 8lka71l7q1kc25f 3r7fer6odl@4ax. com...[color=green]
                  >> Thanks. But, can you show me some sample code. I'm having a lot of
                  >> trouble with this, and haven't done a whole lot of script coding.
                  >>
                  >> Thanks, Don[/color]
                  >
                  >From the "Handling file uploads" section of the PHP manual (www.php.net).
                  >
                  ><?php
                  >$uploaddir = '/var/www/uploads/';
                  >$uploadfile = $uploaddir . $_FILES['userfile']['name'];
                  >
                  >print "<pre>";
                  >if (move_uploaded_ file($_FILES['userfile']['tmp_name'], $uploadfile)) {
                  > print "File is valid, and was successfully uploaded. ";
                  > print "Here's some more debugging info:\n";
                  > print_r($_FILES );
                  >} else {
                  > print "Possible file upload attack! Here's some debugging info:\n";
                  > print_r($_FILES );
                  >}
                  >print "</pre>";
                  >
                  >?>
                  >
                  >This is the server-side PHP code stored in (for instance) a page that is the
                  >file upload form's action.
                  >
                  >Joakim Braun
                  >[/color]
                  Thanks, this is just what I am looking for. Appreciate your help.
                  Don


                  -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
                  http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
                  -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

                  Comment

                  Working...