Heyo,
I've written this PHP script to handle file uploads and it seems to be handling small files okay, like 1-2MB. Anything larger appears to be timing out or something with an error. I've tried several different ini_set options with my script as the host is not my own, no access to php.ini.

Does anyone have any idea what I can do to make this little bastard accept large file uploads and not fail/timeout etc? I have done a lot of searching and I'm just not coming up with any solid results. Thanks guys.

Edit: Sorry for the lack of text wrapping.
[Mod edit: No need to apologise: a wee bit of editing takes care of it.]

<html>
<head>
        <title></title>
</head>
<body>


<?php

ini_set('post_max_size', '90M');
ini_set('upload_max_filesize', '90M');
ini_set('max_input_time', 6000);
ini_set('max_execution_time', 6000);

$dest = $_POST['destination'];

if (!empty($_FILES['ourFile']['name'])) {


if ($dest == "uploads") {

$saveDirectory ="/home/sysera/public_html/themna/harmony_central/mp3_upload/";

}

$tempName = $_FILES['ourFile']['tmp_name'];

$fileName = $_FILES['ourFile']['name'];

$fileName = str_replace(' ', "_", $fileName);

$fileName = str_replace('%20', "_", $fileName);

if (move_uploaded_file($tempName, $saveDirectory . $fileName)) {

if ($dest == "uploads") {
echo "<DIV ALIGN=center><FONT SIZE='2'>You uploaded <b>$filename</b> successfully.
It can be downloaded
<A HREF=http://themna.com/harmony_central/mp3_upload/$fileName>here.</A>
You may continue.<BR></DIV></FONT>
<DIV ALIGN=center><FONT SIZE='2'><A HREF=http://themna.com/harmony_central/mp3_upload/>File list</A>";
echo "<BR>";
}


} else {

echo 'There was an error while uploading the file.';

}

} else {

  ?>

 <DIV ALIGN="center"><form action="<?php echo $_SERVER['PHP_SELF']; ?>"
                      method="post" enctype="multipart/form-data" name="upload">

  <b>Choose a file:</b><br><BR>


<input name="ourFile" type="file" size="75"><br><BR>

  <input name="submit" type="submit" value="Upload"> <b>To </b>

<SELECT NAME="destination">
<OPTION VALUE="uploads">MP3 Uploads
</SELECT>

</form></DIV>

<?php

}
?> 

    If you're in shared hosting enviroment your max upload size
    probably 2M.

    <?
    phpinfo();
    ?>

    upload_max_filesize ??

      Originally posted by George_hu
      If you're in shared hosting enviroment your max upload size
      probably 2M.

      <?
      phpinfo();
      ?>

      upload_max_filesize ??

      Yes, a phpinfo(); lookup does show a 2M limit, but isn't that something I should be able to address with my ini_set for that option? Or am I mistaken?

        I do believe the ini_set was not working for max_upload_filesize, but I was however able to modify it successfully using an addition to my .htaccess file for that scripts home directory.

        With no quotes: "php_value upload_max_filesize 10M"

        Sometimes you find a moment of clarity and it all works out. Hehe, thanks guys. 🙂

          Originally posted by sysera
          I do believe the ini_set was not working for max_upload_filesize, but I was however able to modify it successfully using an addition to my .htaccess file for that scripts home directory.

          With no quotes: "php_value upload_max_filesize 10M"

          Sometimes you find a moment of clarity and it all works out. Hehe, thanks guys. 🙂

          If your host allow to override that parameter....maybe.

            Write a Reply...