SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict ketting00's Avatar
    Join Date
    Jul 2011
    Posts
    310
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    How do you calculate video file size when user upload

    Hi experts,

    As the question above, I want to limit video file size when user upload to under e.g. 5 Mb or not longer than 5 minutes. How can I do that.
    This is the code that I use. I just don't know how to calculate the file size and it's not effective.
    Code:
    if ((($_FILES["video"]["type"] == "video/mp4")
    	|| ($_FILES["video"]["type"] == "video/ogg"))
    	&& ($_FILES["video"]["size"] < 200000000000000000)) {
    }
    Thanks

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,195
    Mentioned
    71 Post(s)
    Tagged
    3 Thread(s)
    Php has to upload the file before it can get its size. I belive Javascript can check the size before upload.

  3. #3
    SitePoint Addict ketting00's Avatar
    Join Date
    Jul 2011
    Posts
    310
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Thanks,

    Sound a lot of headache waiting ahead.

  4. #4
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Which is why I let a third-party service, like Youtube, handle all forms of user submitted videos.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



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
  •