Upload *huge* files, is it wise with PHP ?

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

    Upload *huge* files, is it wise with PHP ?

    Hello,

    I need to allow an end user to upload video files on a server and in the
    same time to put the file name and a few infos in a database. It must be
    very simple for the end user, and uploading with a browser in a form
    would be perfect since it allows to upload and fill a form in the same
    time.

    I'll have full control of the server (no max_size problem etc). The end
    user connexion is ADSL, the server is on a 100mb internet connexion.

    But I'm worried because the file upload by PHP (at least what I code
    usually) will probably timeout (the files will be 200mo at least) or
    have problems, and you can't resumean aborted transfert. FTP would be
    better but it is not as simple for the end user, especially because he
    has to give some more informations (style of the video, how long it has
    to stay on the server etc) wich will be stored in the database..

    What would you use to keep the operations easy, reliable and OS
    independant ? Thanks for any suggestion

    Stephane
    PS: sorry for my weak english

    --
    Stephane
    Please replace "INVALID" by "free" to send me an email.
    Merci de remplacer "INVALID" par "free" pour m'envoyer un email.
  • Tim Van Wassenhove

    #2
    Re: Upload *huge* files, is it wise with PHP ?

    On 2003-12-12, Stephane <Stephane@INVAL ID.fr> wrote:[color=blue]
    > Hello,
    >
    > I need to allow an end user to upload video files on a server and in the
    > same time to put the file name and a few infos in a database. It must be
    > very simple for the end user, and uploading with a browser in a form
    > would be perfect since it allows to upload and fill a form in the same
    > time.
    >
    > I'll have full control of the server (no max_size problem etc). The end
    > user connexion is ADSL, the server is on a 100mb internet connexion.
    >
    > But I'm worried because the file upload by PHP (at least what I code
    > usually) will probably timeout (the files will be 200mo at least) or
    > have problems, and you can't resumean aborted transfert. FTP would be
    > better but it is not as simple for the end user, especially because he
    > has to give some more informations (style of the video, how long it has
    > to stay on the server etc) wich will be stored in the database..
    >
    > What would you use to keep the operations easy, reliable and OS
    > independant ? Thanks for any suggestion[/color]

    ILHO is ftp the only way to go.
    What you could do is let them just submit the text fields, once they
    have done this, you provide them a "config file" that contains the
    settings where things need to be uploaded...

    Now the client only has to call a command like ftp < settings.txt
    With a little program that has dnd support, the client would only have
    to dnd the file over that program to start the upload....

    --
    verum ipsum factum

    Comment

    • FLEB

      #3
      Re: Upload *huge* files, is it wise with PHP ?

      Regarding this well-known quote, often attributed to Tim Van Wassenhove's
      famous "12 Dec 2003 09:45:01 GMT" speech:
      [color=blue]
      > On 2003-12-12, Stephane <Stephane@INVAL ID.fr> wrote:[color=green]
      >> Hello,
      >>
      >> I need to allow an end user to upload video files on a server and in the
      >> same time to put the file name and a few infos in a database. It must be
      >> very simple for the end user, and uploading with a browser in a form
      >> would be perfect since it allows to upload and fill a form in the same
      >> time.
      >>
      >> I'll have full control of the server (no max_size problem etc). The end
      >> user connexion is ADSL, the server is on a 100mb internet connexion.
      >>
      >> But I'm worried because the file upload by PHP (at least what I code
      >> usually) will probably timeout (the files will be 200mo at least) or
      >> have problems, and you can't resumean aborted transfert. FTP would be
      >> better but it is not as simple for the end user, especially because he
      >> has to give some more informations (style of the video, how long it has
      >> to stay on the server etc) wich will be stored in the database..
      >>
      >> What would you use to keep the operations easy, reliable and OS
      >> independant ? Thanks for any suggestion[/color]
      >
      > ILHO is ftp the only way to go.
      > What you could do is let them just submit the text fields, once they
      > have done this, you provide them a "config file" that contains the
      > settings where things need to be uploaded...
      >
      > Now the client only has to call a command like ftp < settings.txt
      > With a little program that has dnd support, the client would only have
      > to dnd the file over that program to start the upload....[/color]

      On that note, if you could put each user's files into a seperate directory
      from the FTP, you could make it an only marginally more difficult process:

      1.) They upload the file via FTP.
      2.) When the upload completes, they go to the website and log in.
      3.) They get a list of their "uploads" directory, and can pick one or more
      files.
      4.) After selecting the correct files, they go to a screen where they can
      add the proper "tagging" information.
      5.) The PHP script then...
      o Moves the files to their proper place on the website (if needed)
      o Associates the information with the file(s)


      Hairballs you might have to watch out for are:
      o Making sure the file is comepletely uploaded before moving it.
      o If the file gets moved to a public area, watch for filename collisions.
      Rename the files if needed, and make sure the tagging reflects the rename.
      o Make sure no one can hijack the system and use it to "implant" files in
      unauthorized areas.


      Barring that, I think PERL, with its more "streaming" (versus PHPs "get the
      upload, then process the output") treatment of POST data, has a few good
      upload progress-bar scripts. It might be something to check out.

      --
      -- 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

      • SwissCheese

        #4
        Re: Upload *huge* files, is it wise with PHP ?

        "Stephane" <Stephane@INVAL ID.fr> wrote in message
        news:slrnbtikma .4d8.Stephane@e rnest.cheska.ne t...[color=blue]
        > Hello,
        >
        > I need to allow an end user to upload video files on a server and in the
        > same time to put the file name and a few infos in a database. It must be
        > very simple for the end user, and uploading with a browser in a form
        > would be perfect since it allows to upload and fill a form in the same
        > time.
        >
        > I'll have full control of the server (no max_size problem etc). The end
        > user connexion is ADSL, the server is on a 100mb internet connexion.
        >
        > But I'm worried because the file upload by PHP (at least what I code
        > usually) will probably timeout (the files will be 200mo at least) or
        > have problems, and you can't resumean aborted transfert. FTP would be
        > better but it is not as simple for the end user, especially because he
        > has to give some more informations (style of the video, how long it has
        > to stay on the server etc) wich will be stored in the database..
        >
        > What would you use to keep the operations easy, reliable and OS
        > independant ? Thanks for any suggestion
        >
        > Stephane
        > PS: sorry for my weak english
        >
        > --
        > Stephane
        > Please replace "INVALID" by "free" to send me an email.
        > Merci de remplacer "INVALID" par "free" pour m'envoyer un email.
        >[/color]

        Have you tried:

        set_time_limit( 0);

        as the first line of your code?

        sets unlimited time - or enter the time in seconds.



        Comment

        • FLEB

          #5
          Re: Upload *huge* files, is it wise with PHP ?

          Regarding this well-known quote, often attributed to SwissCheese's famous
          "Wed, 17 Dec 2003 11:00:48 GMT" speech:
          [color=blue]
          > "Stephane" <Stephane@INVAL ID.fr> wrote in message
          > news:slrnbtikma .4d8.Stephane@e rnest.cheska.ne t...[color=green]
          >> Hello,
          >>
          >> I need to allow an end user to upload video files on a server and in the
          >> same time to put the file name and a few infos in a database. It must be
          >> very simple for the end user, and uploading with a browser in a form
          >> would be perfect since it allows to upload and fill a form in the same
          >> time.
          >>
          >> I'll have full control of the server (no max_size problem etc). The end
          >> user connexion is ADSL, the server is on a 100mb internet connexion.
          >>
          >> But I'm worried because the file upload by PHP (at least what I code
          >> usually) will probably timeout (the files will be 200mo at least) or
          >> have problems, and you can't resumean aborted transfert. FTP would be
          >> better but it is not as simple for the end user, especially because he
          >> has to give some more informations (style of the video, how long it has
          >> to stay on the server etc) wich will be stored in the database..
          >>
          >> What would you use to keep the operations easy, reliable and OS
          >> independant ? Thanks for any suggestion
          >>
          >> Stephane
          >> PS: sorry for my weak english
          >>
          >> --
          >> Stephane
          >> Please replace "INVALID" by "free" to send me an email.
          >> Merci de remplacer "INVALID" par "free" pour m'envoyer un email.
          >>[/color]
          >
          > Have you tried:
          >
          > set_time_limit( 0);
          >
          > as the first line of your code?
          >
          > sets unlimited time - or enter the time in seconds.[/color]

          Would that be "wise", though... if you made some accidental loop in your
          code, that unlimited limit could pose quite a problem, non?

          --
          -- 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

          • SwissCheese

            #6
            Re: Upload *huge* files, is it wise with PHP ?

            "FLEB" <soon.the.sp@mm ers.and.evil.on es.will.bow-down-to.us> wrote in
            message news:96la9ttyyj is.1ltm5m28fj5w k$.dlg@40tude.n et...[color=blue]
            > Regarding this well-known quote, often attributed to SwissCheese's famous
            > "Wed, 17 Dec 2003 11:00:48 GMT" speech:
            >[color=green]
            > > "Stephane" <Stephane@INVAL ID.fr> wrote in message
            > > news:slrnbtikma .4d8.Stephane@e rnest.cheska.ne t...[color=darkred]
            > >> Hello,
            > >>
            > >> I need to allow an end user to upload video files on a server and in[/color][/color][/color]
            the[color=blue][color=green][color=darkred]
            > >> same time to put the file name and a few infos in a database. It must[/color][/color][/color]
            be[color=blue][color=green][color=darkred]
            > >> very simple for the end user, and uploading with a browser in a form
            > >> would be perfect since it allows to upload and fill a form in the same
            > >> time.
            > >>
            > >> I'll have full control of the server (no max_size problem etc). The end
            > >> user connexion is ADSL, the server is on a 100mb internet connexion.
            > >>
            > >> But I'm worried because the file upload by PHP (at least what I code
            > >> usually) will probably timeout (the files will be 200mo at least) or
            > >> have problems, and you can't resumean aborted transfert. FTP would be
            > >> better but it is not as simple for the end user, especially because he
            > >> has to give some more informations (style of the video, how long it has
            > >> to stay on the server etc) wich will be stored in the database..
            > >>
            > >> What would you use to keep the operations easy, reliable and OS
            > >> independant ? Thanks for any suggestion
            > >>
            > >> Stephane
            > >> PS: sorry for my weak english
            > >>
            > >> --
            > >> Stephane
            > >> Please replace "INVALID" by "free" to send me an email.
            > >> Merci de remplacer "INVALID" par "free" pour m'envoyer un email.
            > >>[/color]
            > >
            > > Have you tried:
            > >
            > > set_time_limit( 0);
            > >
            > > as the first line of your code?
            > >
            > > sets unlimited time - or enter the time in seconds.[/color]
            >
            > Would that be "wise", though... if you made some accidental loop in your
            > code, that unlimited limit could pose quite a problem, non?
            >
            > --
            > -- 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
            >[/color]

            Well, that part of the equation is left up to the programmer of the
            script. Take alook at this link:




            Comment

            Working...