1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

File Upload

Discussion in 'HTML & Website Design' started by Weirfire, Oct 3, 2005.

  1. #1
    I'm wanting to upload files over 3MB through a form from a website and I was wondering how I would go about doing this?

    I've tried using

    <form enctype='multipart/form-data' etc >

    but I think the files are just a little too big.


    Any ideas?
     
    Weirfire, Oct 3, 2005 IP
  2. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #2
    If you are using PHP to parse the file, you probably get a timeout of some sort when uploading large files. somewhere in php.cnf there are some parameters you can adjust
     
    frankm, Oct 3, 2005 IP
  3. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #3
    Hmmm, I'll have a look! :confused:

    Thanks :)
     
    Weirfire, Oct 3, 2005 IP
  4. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Here's a quick and dirty upload script that I adapted from one I found on the net (I don't remember where)
    If you don't think that will help, you could always look into php's ftp functions. See also php.net's file upload reference where you can read about the directives file_uploads, upload_max_filesize, upload_tmp_dir, post_max_size and max_input_time in php.ini
     

    Attached Files:

    exam, Oct 3, 2005 IP
    Weirfire likes this.
  5. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #5
    Thanks exam.

    I'll give that a go :)
     
    Weirfire, Oct 4, 2005 IP
  6. boccio

    boccio Peon

    Messages:
    82
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You can get passed php.ini and Apache's configuration that limits file uploads to 2Mb by default. Just override it with .htaccess like:
    
    php_value upload_max_filesize 90M // max size in Mb
    php_value post_max_size 90M // upload size via POST method
    php_value max_input_time 9600 // timeout value in seconds
    
    Code (markup):
    Hope this helps.
     
    boccio, Oct 5, 2005 IP
    Weirfire likes this.
  7. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #7
    Are there any adverse effects to doing it this way?
     
    Weirfire, Oct 5, 2005 IP
  8. boccio

    boccio Peon

    Messages:
    82
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Not likely, used it many times so far...
     
    boccio, Oct 6, 2005 IP
  9. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #9
    What sort of security do you put in place to stop someone spamming the server with 634, 90 MB files?
     
    Weirfire, Oct 6, 2005 IP
  10. boccio

    boccio Peon

    Messages:
    82
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Not sure what exactly are you trying to accomplish. If you wish to allow registered users on your website to send large files via POST, no special security is needed, for they need to authenticate prior to sending files, right? On the other hand, you can always implement RewriteCond to allow/dissalow certain IP ranges, hosts, etc. or put referer check in the script to accept POST only from your form, not some direct request or cURL/similar imitation.
     
    boccio, Oct 6, 2005 IP
  11. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #11
    Thanks boccio
     
    Weirfire, Oct 6, 2005 IP
  12. boccio

    boccio Peon

    Messages:
    82
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Forgot to menion one thing :)

    Setting too high a value can be tricky - if several uploads are being handled concurrently all available memory will be used up and other unrelated scripts that consume a lot of memory might effect the whole server as well.
     
    boccio, Oct 8, 2005 IP
  13. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #13
    Hmmm if you had a fairly popular site and you wanted to allow people to upload movie files how would you do it?

    Would you do it through email?
     
    Weirfire, Oct 8, 2005 IP
  14. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Maybe set up some sort of FTP server and let 'em FTP them in.
     
    exam, Oct 8, 2005 IP