SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    Non-Member I87's Avatar
    Join Date
    Mar 2006
    Location
    UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    a few questions about uploading videos on the fly with php

    1) is this best doing in PHP or another coding laungage?
    2) how do you make it so users can see how many kb has been uploaded?
    3) how do you make them smaller (lower the quality)
    4) is there an upload limit on php.inc
    5) what function do you use to upload them?
    6) what are the security issues?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    a few questions about uploading videos on the fly with php
    What other kind of uploading is there except "on the fly"?

    1) is this best doing in PHP or another coding laungage?
    You can do the web part in PHP easily. You can't lower the quality of a video in PHP easily.

    2) how do you make it so users can see how many kb has been uploaded?
    An interactive upload status would require JavaScript as well as server-side coding, or a Java applet.

    3) how do you make them smaller (lower the quality)
    With an external program. PHP has no video manipulation abilities.

    4) is there an upload limit on php.inc
    Yes, but you can change it to whatever you want.

    5) what function do you use to upload them?
    Uploading files is a web browser ability. You just need a form with a file input. Once it's uploaded, you'd use the PHP function move_uploaded_file() or move() to put the file somewhere permanent.]

    6) what are the security issues?
    Security issues of what?

  3. #3
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're not really uploading with PHP, you're really just using PHP to manage a file uploaded with a form (you must set enctype="multipart/form-data" in the <form> tag). Thus you can't display any real time progress bar or anything of that nature with pure PHP. That'd require client side interaction.
    PHP doesn't get involved until the file has finished uploading.

    AFAIK PHP doesn't have any tools for video editing (compressing etc.) There may be a third party extension to handle that functionality, but I haven't come across any such thing. (I've also never come across a lion in the wild, but they exist)

    There are two upload limits in php.ini (not inc). POST max size, and max upload size.
    Do a search in the php documentation for changing those values locally.

    Security - you need to be sure files you copy (after an upload) were in fact uploaded files, and that you are not being tricked into copying an existing system file, or a PHP script. Use the is_uploaded_file function to check for this.

    While your at it, have a read of the File upload section of the manual

    And finally, if youre expecting big files an anonymous FTP account might be more reliable than HTTP uploads. You could always use PHP to check, move or delete files after being uploaded with FTP so your app can still control them

  4. #4
    Non-Member I87's Avatar
    Join Date
    Mar 2006
    Location
    UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm
    would it be better doing it in another coding laungage?
    I see photobucket converts the file to flash, how is this possible with any type of coding?

  5. #5
    Non-Member I87's Avatar
    Join Date
    Mar 2006
    Location
    UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think youtube and myspace do the same
    I need to do some research on this o_0

  6. #6
    Non-Member I87's Avatar
    Join Date
    Mar 2006
    Location
    UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've found a program that does that non-server side
    but it's double the file size

  7. #7
    SitePoint Evangelist
    Join Date
    Apr 2006
    Location
    Halifax, Canada
    Posts
    498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see photobucket converts the file to flash, how is this possible with any type of coding?
    They probably don't convert the file to flash, they just create a flash file that knows where the image is stored on the server and load it.

    To convert videos on the server, look into ffmpeg.

    For file upload progress, this cannot be done entirely PHP. The script that handles the actual upload has to be done in Perl or another server side language (I think Ruby will work, possibly Python and JSP as well).

    As for security, make a list of valid movie files and check that the file extension being uploaded is on the list. And never use include on an uploaded file.
    Paul Butler.org
    JSSpamBlock - Reduce WordPress spam.

  8. #8
    Non-Member I87's Avatar
    Join Date
    Mar 2006
    Location
    UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you for the information
    I think I'm going to pay someone who knows what they're doing to do this part of the site

    thanks everyone once again.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •