SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    florida
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Upload .CSV issue

    Hey all,

    I am trying to upload a csv to my server. I have used the following script to upload Images, other text files and all without incedent. I am thinking that this is a size issue. For instance i get this result if I upload a gif () from print_r

    --------------------------------------------------
    Array
    (
    [file] => Array
    (
    [name] => about.gif
    [type] => image/gif
    [tmp_name] => D:\PHP\uploadtemp\php39.tmp
    [error] => 0
    [size] => 10235
    )

    )

    --------------------------------------------------

    Once I use a file larger than say 2 megs, I get this from print_r:

    --------------------------------------------------
    Array
    (
    [file] => Array
    (
    [name] => temp.csv
    [type] =>
    [tmp_name] =>
    [error] => 1
    [size] => 0
    )

    )
    --------------------------------------------------

    I made sure to turn the maxSize way up for testing purposes but that hasn't helped.Anyone got any ideas? Here's my Code:

    PHP Code:

    <?php 
    if (isset($_FILES['file'])) {

    //echo "<pre>";
    //print_r($_FILES);
    //echo "</pre>";


        
    $KW_max_size=9000000000000;
        
    $extension="";
        if (
    is_uploaded_file($_FILES['file']['tmp_name'])) { 
            if(
    $_FILES['file']['size'] <= $KW_max_size) { 
                
    $realname $_FILES['file']['name']; 
                
    $ext_array =explode(".",$realname);
                
    $last_position count($ext_array) - 1
                
    $extension $ext_array[$last_position];
                
    $extAllowed=array ('all');
                
    $ii=count($extAllowed); 
                
    $flag=0;
                for(
    $i=0;$i<$ii;$i++){ 
                    if (
    $extAllowed[$i]==$extension)
                        
    $flag=1;
                }
                if (
    $extAllowed[0]=="all")
                    
    $flag=1;
                if(
    copy($_FILES['file']['tmp_name'], "DBBackUps/".$realname) && $flag==1) { 
                    
    Header("Location: login.php"); 
                     } else 
    Header("Location: size.php"); 
            } else 
    Header("Location: failed.php");
        } else     
    Header("Location: ext.php");   // Errors out here:
    }
    ?>
    P.S. this code is generated from a DreamWeaver extension (OK so I'm lazy but I'm trying to hit deadline here :-)

    Thanks
    Sum
    sum@logicstation.net

  2. #2
    &lt;!-- Insert thoughts here --&gt; pitcher17's Avatar
    Join Date
    Apr 2004
    Location
    The great white north
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Shot in the dark.. but have you restarted the web server so that it will read the new php.ini file and get the new Max file size?
    The more time I save by not planning and documenting,
    the more time I have left to debug.


  3. #3
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    umm. why there are 2 posts for the same thing. i posted in the other one and pitcher17 posted in this one.

    so, can somebody take one out to avoid confusion

  4. #4
    SitePoint Member
    Join Date
    Jan 2005
    Location
    florida
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry everyone, everyone for the double post, especially when it is an issue with the hosting company limiting the size in php.ini (which I have no access to) Please dis regard this post and delete it

    thanks


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
  •