Sorun yükleme dosyası

2 Cevap php

i have the form, and i want to upload two files. here is the script

<form action="form.php" method="post" enctype="multipart/form-data" />
<input type="file" name="video"  />
<input type="file" name="picture" >
<input type="submit"  class="input" value="Հիշել" />
<input type="hidden" name="MAX_FILE_SIZE" value="100000000" />
</form>

form.php:

<?
    print_r($_FILES);
    $video_name = $_FILES["video"]["name"];
    $image_name = $_FILES["picture"]["name"];
    echo "video",$video_name;
    echo "image",$image_name;
                              //returns Array ( ) videoimage
?>

when i try to upload the file greater than 10MB, it doesn't happen. i try in many browsers. maybe i must change some field in php.ini? but i haven't permission to change them on the server. so what can i do? thanks

2 Cevap

File Uploads - Common Pitfalls

The MAX_FILE_SIZE item cannot specify a file size greater than the file size that has been set in the upload_max_filesize in the php.ini file. The default is 2 megabytes.

If a memory limit is enabled, a larger memory_limit may be needed. Make sure you set memory_limit large enough.

...

If post_max_size is set too small, large files cannot be uploaded. Make sure you set post_max_size large enough.

Sen MAX_FILE_SIZE three dört yolu için değerini artırabilirsiniz:

1) php.ini

upload_max_filesize = 20M
post_max_size = 20M

2) ini_set ()

ini_set('upload_max_filesize', 20M);
ini_set('post_max_size', 20M);

3). Htaccess

php_value upload_max_filesize 20M
php_value post_max_size 20M

4) gizli form alanları

<input name="MAX_FILE_SIZE" value="20971520" type="hidden">

Php.ini, upload_max_filesize yönergesini ayarlayın. Ayrıca daha yüksek bir sayıya memory_limit ayarlayın.