Board index   FAQ   Search  
Register  Login
Board index php forum :: Database phpMyAdmin

can not upload large file in server

How to use phpmyadmin.... phpmyadmin related arguments. Even phpMyAdmin issues

Moderators: macek, egami, gesf

can not upload large file in server

Postby nishith » Fri Oct 07, 2011 5:46 am

Hello,
From two days, I am trying to upload video and audio files in the server, but I can not upload files larger than 2 mb. How can I solve it. I google the problem and found that the php.ini file should be configured for this problem, but it is for the localhost. How can i do that in server? :help:

Please help me.

Thanks
Nishith
nishith
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri Oct 07, 2011 5:40 am

Re: can not upload large file in server

Postby egami » Fri Oct 07, 2011 5:55 am

well..
php.ini has two things that need to be changed in order to accept large file uploads.

one is the post_max_size and the other is upload_max_filesize

enjoy.
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2197
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: can not upload large file in server

Postby nishith » Fri Oct 07, 2011 6:24 am

Thank you egami,

But I just bought the server. Where I will find the php.ini file. I think i will not allow to configure it. I am not talking about the localhost.

Please help me.
nishith
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri Oct 07, 2011 5:40 am

Re: can not upload large file in server

Postby nishith » Fri Oct 07, 2011 8:05 am

Hello,

The code i used for uploading is....
upload.html
Code: Select all
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <form enctype="multipart/form-data" action="uploader.php" method="POST">

Choose a file to upload: <input name="file" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
  </body>
</html>


uploader.php

Code: Select all
<?php


$name = htmlspecialchars($_FILES["file"]["name"]);
$type = htmlspecialchars($_FILES["file"]["type"]);
$size = htmlspecialchars($_FILES["file"]["size"]);
$path = htmlspecialchars($_FILES["file"]["tmp_name"]);



    if ($_FILES["file"]["error"] > 0) {
        echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    } else {
        echo "Upload: " . $name . "<br />";
        echo "Type: " . $type . "<br />";
        echo "Size: " .$size. " Kb<br />";
        echo "Temp file: " . $path. "<br />";

        if (file_exists("upload/" . $name)) {
            echo $name. " already exists. ";
        } else {
            move_uploaded_file($path, "upload/" . $name);
            echo "Stored in: " . "upload/" . $name."<br /><br />";
        }
    }

   

?>



To upload file greater than 2MB , i used the .htaccess in the root directory of the server...
.htaccess
Code: Select all
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 0
php_value max_input_time 0


But it still not working. If i try to upload file > 2MB, it returns error code 1.

Please help me. :help:

Thanks
Nishith
nishith
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri Oct 07, 2011 5:40 am


Return to phpMyAdmin

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.