File Upload Problem

Discussion in 'PHP' started by dizyn, Jan 20, 2010.

  1. #1
    Hi

    I am having problem in image uploading, I get memory exhausted errors. Is there anyway that play with memory. If i upload an image of like 2.5MB it works but if i try to upload same image i.e. 5 times in a row then i start get memory errors.

    I think this could be solved by memory management, but i have no idea if there is a way of memory management in php.

    Here is my code for uploading, I am also doing image resize using GD library

    move_uploaded_file($_FILES['imgfile1']['tmp_name'], $uploaddir.'/'.$_FILES['imgfile1']['name']);		
    PHP:
    Thanks
     
    dizyn, Jan 20, 2010 IP
  2. riamathews

    riamathews Peon

    Messages:
    306
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Open php.ini in your Web server and try changing the line like "memory_limit = 16M" to the desired size...Try it and test it...
     
    riamathews, Jan 21, 2010 IP
  3. masterofweb

    masterofweb Greenhorn

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    solve this problem or not?u have a problem on server or local machine....
     
    masterofweb, Jan 21, 2010 IP
  4. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #4
    from the description of problem riamathews' solution should help. If not, please share exact error to give better idea of problem..
     
    mastermunj, Jan 21, 2010 IP
  5. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #5

    If you don't have php.ini access, then you can edit your .htaccess, which usually located in your root path (if you don't have one already create one) and place inside the following:

    php_value memory_limit 16M
    Code (markup):
    You can then change it accordingly to your needs.
     
    danx10, Jan 21, 2010 IP