PHP and file uploads

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

    PHP and file uploads

    Hi All,

    Here's one thing that I don't know much about - file uploading. As part of
    my project, I will have to build a file manager of sorts - perhaps a
    document manager. Anyhow, this involves allowing my user to upload files to
    a location.

    I know PHP can do it - I know this because it sure does everything else ...
    but I don't know this from any authoritative source.

    So ... can you tell me if PHP can handle files uploads, and if so, what are
    the drawbacks that you might have learned of in your experience? For
    instance, in the ASP world, using a COM object for the upload works, but
    apparently has significant impact on performance.

    So anyway, advise (advice???) me ...

    Thanks,
    Santosh


  • Richard Grove

    #2
    Re: PHP and file uploads

    "OneSolutio n" <onesolution@ja takainc.com> wrote in message
    news:IGiwb.171$ q57.133805181@n ewssvr11.news.p rodigy.com...[color=blue]
    > Hi All,
    >
    > Here's one thing that I don't know much about - file uploading. As part[/color]
    of[color=blue]
    > my project, I will have to build a file manager of sorts - perhaps a
    > document manager. Anyhow, this involves allowing my user to upload files[/color]
    to[color=blue]
    > a location.
    >
    > I know PHP can do it - I know this because it sure does everything else[/color]
    ....[color=blue]
    > but I don't know this from any authoritative source.
    >
    > So ... can you tell me if PHP can handle files uploads, and if so, what[/color]
    are[color=blue]
    > the drawbacks that you might have learned of in your experience? For
    > instance, in the ASP world, using a COM object for the upload works, but
    > apparently has significant impact on performance.
    >
    > So anyway, advise (advice???) me ...
    >
    > Thanks,
    > Santosh
    >
    >[/color]

    It's really easy, just use the right form field, and be sure to copy it to a
    location. Remember, it is a temp file until you copy it somewhere. This
    means it is gone once your script has finished.

    $filename=$HTTP _POST_FILES['file']['name'];
    $uploadedtempfi le=$HTTP_POST_F ILES['file']['tmp_name'];
    $newfilepath="W HATEVER";
    copy ($uploadedtempf ile, $newfilepath);

    Regards
    Richard Grove

    http://shopbuilder.org - ecommerce systems
    Become a Shop Builder re-seller:
    Affiliate marketing is a simple way to earn money online, using our affiliate platform. Join a global community of publishers and advertisers.

    Affiliate marketing is a simple way to earn money online, using our affiliate platform. Join a global community of publishers and advertisers.






    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.536 / Virus Database: 331 - Release Date: 03/11/2003


    Comment

    • Von Heler

      #3
      Re: PHP and file uploads

      "Richard Grove" <info[at]redeyemedia[dot]co[dot]uk> wrote in
      news:3fc1cb60$0 $103$65c69314@m ercury.nildram. net:
      [color=blue]
      > "OneSolutio n" <onesolution@ja takainc.com> wrote in message
      > news:IGiwb.171$ q57.133805181@n ewssvr11.news.p rodigy.com...[color=green]
      >> Hi All,
      >>
      >> Here's one thing that I don't know much about - file uploading. As
      >> part[/color]
      > of[color=green]
      >> my project, I will have to build a file manager of sorts - perhaps a
      >> document manager. Anyhow, this involves allowing my user to upload
      >> files[/color]
      > to[color=green]
      >> a location.
      >>
      >> I know PHP can do it - I know this because it sure does everything
      >> else[/color]
      > ...[color=green]
      >> but I don't know this from any authoritative source.
      >>
      >> So ... can you tell me if PHP can handle files uploads, and if so,
      >> what[/color]
      > are[color=green]
      >> the drawbacks that you might have learned of in your experience? For
      >> instance, in the ASP world, using a COM object for the upload works,
      >> but apparently has significant impact on performance.
      >>
      >> So anyway, advise (advice???) me ...
      >>
      >> Thanks,
      >> Santosh
      >>
      >>[/color]
      >
      > It's really easy, just use the right form field, and be sure to copy
      > it to a location. Remember, it is a temp file until you copy it
      > somewhere. This means it is gone once your script has finished.
      >
      > $filename=$HTTP _POST_FILES['file']['name'];
      > $uploadedtempfi le=$HTTP_POST_F ILES['file']['tmp_name'];
      > $newfilepath="W HATEVER";
      > copy ($uploadedtempf ile, $newfilepath);
      >
      > Regards
      > Richard Grove
      >
      > http://shopbuilder.org - ecommerce systems
      > Become a Shop Builder re-seller:
      > http://www.affiliatewindow.com/affil...ls.php?mid=611
      > http://www.affiliatewindow.com/a.pl?590
      >
      >
      >
      >
      >
      > ---
      > Outgoing mail is certified Virus Free.
      > Checked by AVG anti-virus system (http://www.grisoft.com).
      > Version: 6.0.536 / Virus Database: 331 - Release Date: 03/11/2003
      >
      >
      >[/color]

      You could think about using PEAR http upload, which I found useful.

      VonHeler

      Comment

      • Von Heler

        #4
        Re: PHP and file uploads

        Von Heler <vonheler@hotma il.com> wrote in
        news:Xns943D63D 76C9C8vonvonde@ 130.133.1.4:
        [color=blue]
        > "Richard Grove" <info[at]redeyemedia[dot]co[dot]uk> wrote in
        > news:3fc1cb60$0 $103$65c69314@m ercury.nildram. net:
        >[color=green]
        >> "OneSolutio n" <onesolution@ja takainc.com> wrote in message
        >> news:IGiwb.171$ q57.133805181@n ewssvr11.news.p rodigy.com...[color=darkred]
        >>> Hi All,
        >>>
        >>> Here's one thing that I don't know much about - file uploading. As
        >>> part[/color]
        >> of[color=darkred]
        >>> my project, I will have to build a file manager of sorts - perhaps a
        >>> document manager. Anyhow, this involves allowing my user to upload
        >>> files[/color]
        >> to[color=darkred]
        >>> a location.
        >>>
        >>> I know PHP can do it - I know this because it sure does everything
        >>> else[/color]
        >> ...[color=darkred]
        >>> but I don't know this from any authoritative source.
        >>>
        >>> So ... can you tell me if PHP can handle files uploads, and if so,
        >>> what[/color]
        >> are[color=darkred]
        >>> the drawbacks that you might have learned of in your experience? For
        >>> instance, in the ASP world, using a COM object for the upload works,
        >>> but apparently has significant impact on performance.
        >>>
        >>> So anyway, advise (advice???) me ...
        >>>
        >>> Thanks,
        >>> Santosh
        >>>
        >>>[/color]
        >>
        >> It's really easy, just use the right form field, and be sure to copy
        >> it to a location. Remember, it is a temp file until you copy it
        >> somewhere. This means it is gone once your script has finished.
        >>
        >> $filename=$HTTP _POST_FILES['file']['name'];
        >> $uploadedtempfi le=$HTTP_POST_F ILES['file']['tmp_name'];
        >> $newfilepath="W HATEVER";
        >> copy ($uploadedtempf ile, $newfilepath);
        >>
        >> Regards
        >> Richard Grove
        >>
        >> http://shopbuilder.org - ecommerce systems
        >> Become a Shop Builder re-seller:
        >> http://www.affiliatewindow.com/affil...ls.php?mid=611
        >> http://www.affiliatewindow.com/a.pl?590
        >>
        >>
        >>
        >>
        >>
        >> ---
        >> Outgoing mail is certified Virus Free.
        >> Checked by AVG anti-virus system (http://www.grisoft.com).
        >> Version: 6.0.536 / Virus Database: 331 - Release Date: 03/11/2003
        >>
        >>
        >>[/color]
        >
        > You could think about using PEAR http upload, which I found useful.
        >
        > VonHeler
        >[/color]


        Comment

        • kafooey

          #5
          Re: PHP and file uploads

          On Mon, 24 Nov 2003 07:45:44 GMT, "OneSolutio n"
          <onesolution@ja takainc.com> wrote:
          [color=blue]
          >So ... can you tell me if PHP can handle files uploads, and if so, what are
          >the drawbacks that you might have learned of in your experience? For
          >instance, in the ASP world, using a COM object for the upload works, but
          >apparently has significant impact on performance.[/color]

          PHP does file uploads - but you need to check the server is configured
          to allow it easily. The upload methods built into the language can be
          turned off in the PHP configuration file on the server.

          If you are running in some kind of "safe" environment where the upload
          facility has been switched off, you can usually get around it by
          opening an FTP connection and sending the various FTP commands (which
          works really well actually).


          kafooey
          - kafooey@nospam. yahoo.co.uk
          - http://www.pluggedout.com/blog

          Comment

          • R. Rajesh Jeba Anbiah

            #6
            Re: PHP and file uploads

            "OneSolutio n" <onesolution@ja takainc.com> wrote in message news:<IGiwb.171 $q57.133805181@ newssvr11.news. prodigy.com>...[color=blue]
            > Hi All,
            >
            > Here's one thing that I don't know much about - file uploading. As part of
            > my project, I will have to build a file manager of sorts - perhaps a
            > document manager. Anyhow, this involves allowing my user to upload files to
            > a location.
            >
            > I know PHP can do it - I know this because it sure does everything else ...
            > but I don't know this from any authoritative source.
            >
            > So ... can you tell me if PHP can handle files uploads, and if so, what are
            > the drawbacks that you might have learned of in your experience? For
            > instance, in the ASP world, using a COM object for the upload works, but
            > apparently has significant impact on performance.
            >
            > So anyway, advise (advice???) me ...[/color]

            1. Use Google ( http://www.google.com/search?q=file+upload+PHP )
            2. Use php.net (
            http://www.google.com/search?q=file+...ww%2Ephp%2Enet )

            ---
            "Dying is an art, like everything else"---Sylvia Plath
            Email: rrjanbiah-at-Y!com

            Comment

            • FLEB

              #7
              Re: PHP and file uploads

              Regarding this well-known quote, often attributed to OneSolution's famous
              "Mon, 24 Nov 2003 07:45:44 GMT" speech:
              [color=blue]
              > Hi All,
              >
              > Here's one thing that I don't know much about - file uploading. As part of
              > my project, I will have to build a file manager of sorts - perhaps a
              > document manager. Anyhow, this involves allowing my user to upload files to
              > a location.
              >
              > I know PHP can do it - I know this because it sure does everything else ...
              > but I don't know this from any authoritative source.
              >
              > So ... can you tell me if PHP can handle files uploads, and if so, what are
              > the drawbacks that you might have learned of in your experience? For
              > instance, in the ASP world, using a COM object for the upload works, but
              > apparently has significant impact on performance.
              >
              > So anyway, advise (advice???) me ...
              >
              > Thanks,
              > Santosh[/color]

              The only drawback of PHP uploading is that the entire file(s) needs to be
              uploaded before PHP processes, which rules out things like progress bars
              and stopping invalid uploads early.

              There's a PERL-to-PHP sort of snap-in for this that someone's made, but I
              don't recall the URL (anyone?).

              --
              -- Rudy Fleminger
              -- sp@mmers.and.ev il.ones.will.bo w-down-to.us
              (put "Hey!" in the Subject line for priority processing!)
              -- http://www.pixelsaredead.com

              Comment

              • R. Rajesh Jeba Anbiah

                #8
                Re: PHP and file uploads

                FLEB <soon.the.sp@mm ers.and.evil.on es.will.bow-down-to.us> wrote in message news:<1gzrnr9at pp9e$.1vgb810lp 9j7h$.dlg@40tud e.net>...[color=blue]
                > Regarding this well-known quote, often attributed to OneSolution's famous
                > "Mon, 24 Nov 2003 07:45:44 GMT" speech:
                >[color=green]
                > > Hi All,
                > >
                > > Here's one thing that I don't know much about - file uploading. As part of
                > > my project, I will have to build a file manager of sorts - perhaps a
                > > document manager. Anyhow, this involves allowing my user to upload files to
                > > a location.
                > >
                > > I know PHP can do it - I know this because it sure does everything else ...
                > > but I don't know this from any authoritative source.
                > >
                > > So ... can you tell me if PHP can handle files uploads, and if so, what are
                > > the drawbacks that you might have learned of in your experience? For
                > > instance, in the ASP world, using a COM object for the upload works, but
                > > apparently has significant impact on performance.
                > >
                > > So anyway, advise (advice???) me ...
                > >
                > > Thanks,
                > > Santosh[/color]
                >
                > The only drawback of PHP uploading is that the entire file(s) needs to be
                > uploaded before PHP processes, which rules out things like progress bars
                > and stopping invalid uploads early.
                >
                > There's a PERL-to-PHP sort of snap-in for this that someone's made, but I
                > don't recall the URL (anyone?).[/color]



                ---
                "Dying is an art, like everything else"---Sylvia Plath
                Email: rrjanbiah-at-Y!com

                Comment

                Working...