Ciao,
Fac un site pt cineva shi are un domeniu la un server de web unde e Apache shi are shi php. Chestia e ca vreau sa fac upload de fisiere acolo, care sa aiba poate dimensiuni chiar de zeci de mega. Cum nu pot modifica php.ini, n-am acces, shi nici cu ini_set nu are efec am incercat cu un fisier .htaccess in folderul de upload, unde am pus:
php_value upload_max_filesize "100M"
php_value post_max_size "100M"
php_value memory_limit "100M"
php_value max_execution_time "600"
upload_max_filesize="100M"
post_max_size="100M"
memory_limit="100M"
max_execution_time=600
LimitRequestBody 102400000
dar nu merge. .htaccess sunt enable ca am testat cu alt .htaccess file deci nu aia e problema.
Shtie cineva cum sa fac?
mercy,
whiteadi
upload size - apache - php
Moderatori: Zamolxe, Moderatori
Din cate stiu eu, cu htacces modifici drepturile pentru folderul/fisierul respectiv, nu poti face override la setarile din php.ini. Vezi http://www.freewebmasterhelp.com/tutorials/htaccess
Foloseste un phpinfo ca sa vezi valorile variabilelor PHP care te intereseaza.
Alternativa ar fi (daca ai acces FTP) e sa faci uploadul prin FTP (vezi functiile PHP pt FTP).
Foloseste un phpinfo ca sa vezi valorile variabilelor PHP care te intereseaza.
Alternativa ar fi (daca ai acces FTP) e sa faci uploadul prin FTP (vezi functiile PHP pt FTP).
-
whiteadi
- PHPRomania Supporter
- Mesaje: 26
- Membru din: Joi Mar 04, 2004 12:25 pm
- Localitate: Timisoara
- Contact:
exista nishte directive ce pot fi puse in .htaccess sa setez variabilele pt php pt acel folder
oricum am vorbit cu aia de la server shi au setat in httpd.conf
post_max_size = 100M
upload_max_filesize = 100M
max_execution_time = 600
pt. domeniul meu,
shi zice ca shi memory_limit la 100M, aceste valori fiind local values pt php, shi le verific shi is corecte doar memory_limit nu o arata. Insa tot nu merge, peste 2 mega nu ma lasa sa fac upload!
oricum am vorbit cu aia de la server shi au setat in httpd.conf
post_max_size = 100M
upload_max_filesize = 100M
max_execution_time = 600
pt. domeniul meu,
shi zice ca shi memory_limit la 100M, aceste valori fiind local values pt php, shi le verific shi is corecte doar memory_limit nu o arata. Insa tot nu merge, peste 2 mega nu ma lasa sa fac upload!
- iepurec
- Average Member
- Mesaje: 102
- Membru din: Lun Iun 30, 2003 5:14 pm
- Localitate: Timisoara
- Contact:
Fisierul meu de .htaccess
Calin Iepure,
Development Director @ x3studios.com
Development Director @ x3studios.com
-
whiteadi
- PHPRomania Supporter
- Mesaje: 26
- Membru din: Joi Mar 04, 2004 12:25 pm
- Localitate: Timisoara
- Contact:
hmm 3
am pus un .htaccess cu astea in el:
<Limit GET POST>
php_value upload_max_filesize "100M"
</Limit>
php_value post_max_size "100M"
php_value memory_limit "100M"
php_value max_execution_time "600"
in folderul x shi apoi shi de fac un subfolder x1 in care se face upload il copiez automat shi acolo acest fishier .htaccess , pe linux, shi ... nu merge
pana la urma am facut un sistem ca daca ii peste 2 mega admin-ul sa puna in calea ce i-o dau eu, cu un client ftp, fishierele shi doar sa notifice platforma de unde eu verific pe server shi bag datele despre fishier in baza de date
sa repet: mie nu imi merge upload peste 2 mega, daca fac submit la o forma cu un fishier peste 2 mega INSTANTANEU da The page cannot be displayed (cannpt find server).
iata shi codul cu care fac , poate o fi o buba in el:
[php]...
if($HTTP_GET_VARS['id']){
$work_id = $HTTP_GET_VARS['id'];
}else{
$work_id = $HTTP_POST_VARS['id'];
}
if($HTTP_POST_VARS['submit']){
if(is_mixed(trim($HTTP_POST_VARS['name']))){
$sql = "Select name from files where name = '" . trim($HTTP_POST_VARS['name']) . "' and workarea_id = " . $work_id;
$nrc=db_query($sql);
if ($nrc && db_numrows($nrc) > 0) {
$feedback .= "<span class=\"c12Red\"> Already exists a file with this name in this workarea.</span><br>";
} else {
$userfile_error = $_FILES['userfile']['error'];
if ($userfile_error > 0)
{
echo 'Problem: ';
switch ($userfile_error)
{
case 1: $feedback .= 'File exceeded upload_max_filesize'; break;
case 2: $feedback .= 'File exceeded max_file_size'; break;
case 3: $feedback .= 'File only partially uploaded'; break;
case 4: $feedback .= 'No file uploaded'; break;
}
}
if(!$feedback){
if (is_uploaded_file($_FILES['fisier']['tmp_name'])) {
//if(!is_dir("../" . $the_path . "/" . $work_id)){
// mkdir("../" . $the_path . "/" . $work_id,0755);
// chmod ("../" . $the_path . "/" . $work_id,0775);
// if(!copy("../ht/.htaccess","../" . $the_path . "/" . $work_id . "/.htaccess")){
// $feedback .= "Could not set upload size ";
// }
//}
if(move_uploaded_file($_FILES['fisier']['tmp_name'], "../" . $the_path . "/" . $work_id . "/" . $_FILES['fisier']['name'])){
}else{
$feedback .= "Could not move the file: " . $_FILES['fisier']['tmp_name'];
}
} else {
$feedback .= "Possible file upload attack. Filename: " . $_FILES['fisier']['tmp_name'];
}
}
if(!$feedback){
$sql="Insert into files (name,workarea_id,file_path) Values('" . trim($HTTP_POST_VARS['name']). "'," . $work_id . ",'" . $the_path . "/" . $work_id . "/" . $_FILES['fisier']['name'] . "')";
$nrc=db_query($sql);
if (!$nrc || db_affected_rows($nrc) < 1) {
$feedback .= "<span class=\"c12Red\"> Error: " .db_error() . " sql: " . $sql . "</span";
} else {
$feedback .= "<span class=\"c12red\"> File Added </span>";
}
}
}
}
?>
<span class="c12Red"><?=$feedback?></span><?
}
?>[/php] <br>
<span class="c12black">Add file less than 2 Megabytes</span>
<br>
<br>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<form name="addfile" onsubmit="return validateForm(this)" enctype="multipart/form-data" method="post" action="<?=$PHP_SELF?>">
<tr>
<td width="100" class="c12black">File Name</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td width="100" class="c12black">The file</td>
<td><input type="file" name="fisier"></td>
</tr>
<tr>
<td width="100" height="30"> </td>
<td><input type="hidden" name="MAX_FILE_SIZE" value="102400000">
<input type="hidden" name='id' value="<?=$work_id?>">
<input type="submit" name="submit" value="submit">
</td>
</tr>
<tr>
<td colspan="2">
<span class="c12black1">[ <a href="files.php?id=<?=$work_id?>" class="c12black1">Back</a> ]</span>
</td>
</tr>
</form>
</table>
<script type="text/javascript"><!--
document.addfile.name.focus();
//--></script>
...
<Limit GET POST>
php_value upload_max_filesize "100M"
</Limit>
php_value post_max_size "100M"
php_value memory_limit "100M"
php_value max_execution_time "600"
in folderul x shi apoi shi de fac un subfolder x1 in care se face upload il copiez automat shi acolo acest fishier .htaccess , pe linux, shi ... nu merge
pana la urma am facut un sistem ca daca ii peste 2 mega admin-ul sa puna in calea ce i-o dau eu, cu un client ftp, fishierele shi doar sa notifice platforma de unde eu verific pe server shi bag datele despre fishier in baza de date
sa repet: mie nu imi merge upload peste 2 mega, daca fac submit la o forma cu un fishier peste 2 mega INSTANTANEU da The page cannot be displayed (cannpt find server).
iata shi codul cu care fac , poate o fi o buba in el:
[php]...
if($HTTP_GET_VARS['id']){
$work_id = $HTTP_GET_VARS['id'];
}else{
$work_id = $HTTP_POST_VARS['id'];
}
if($HTTP_POST_VARS['submit']){
if(is_mixed(trim($HTTP_POST_VARS['name']))){
$sql = "Select name from files where name = '" . trim($HTTP_POST_VARS['name']) . "' and workarea_id = " . $work_id;
$nrc=db_query($sql);
if ($nrc && db_numrows($nrc) > 0) {
$feedback .= "<span class=\"c12Red\"> Already exists a file with this name in this workarea.</span><br>";
} else {
$userfile_error = $_FILES['userfile']['error'];
if ($userfile_error > 0)
{
echo 'Problem: ';
switch ($userfile_error)
{
case 1: $feedback .= 'File exceeded upload_max_filesize'; break;
case 2: $feedback .= 'File exceeded max_file_size'; break;
case 3: $feedback .= 'File only partially uploaded'; break;
case 4: $feedback .= 'No file uploaded'; break;
}
}
if(!$feedback){
if (is_uploaded_file($_FILES['fisier']['tmp_name'])) {
//if(!is_dir("../" . $the_path . "/" . $work_id)){
// mkdir("../" . $the_path . "/" . $work_id,0755);
// chmod ("../" . $the_path . "/" . $work_id,0775);
// if(!copy("../ht/.htaccess","../" . $the_path . "/" . $work_id . "/.htaccess")){
// $feedback .= "Could not set upload size ";
// }
//}
if(move_uploaded_file($_FILES['fisier']['tmp_name'], "../" . $the_path . "/" . $work_id . "/" . $_FILES['fisier']['name'])){
}else{
$feedback .= "Could not move the file: " . $_FILES['fisier']['tmp_name'];
}
} else {
$feedback .= "Possible file upload attack. Filename: " . $_FILES['fisier']['tmp_name'];
}
}
if(!$feedback){
$sql="Insert into files (name,workarea_id,file_path) Values('" . trim($HTTP_POST_VARS['name']). "'," . $work_id . ",'" . $the_path . "/" . $work_id . "/" . $_FILES['fisier']['name'] . "')";
$nrc=db_query($sql);
if (!$nrc || db_affected_rows($nrc) < 1) {
$feedback .= "<span class=\"c12Red\"> Error: " .db_error() . " sql: " . $sql . "</span";
} else {
$feedback .= "<span class=\"c12red\"> File Added </span>";
}
}
}
}
?>
<span class="c12Red"><?=$feedback?></span><?
}
?>[/php] <br>
<span class="c12black">Add file less than 2 Megabytes</span>
<br>
<br>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<form name="addfile" onsubmit="return validateForm(this)" enctype="multipart/form-data" method="post" action="<?=$PHP_SELF?>">
<tr>
<td width="100" class="c12black">File Name</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td width="100" class="c12black">The file</td>
<td><input type="file" name="fisier"></td>
</tr>
<tr>
<td width="100" height="30"> </td>
<td><input type="hidden" name="MAX_FILE_SIZE" value="102400000">
<input type="hidden" name='id' value="<?=$work_id?>">
<input type="submit" name="submit" value="submit">
</td>
</tr>
<tr>
<td colspan="2">
<span class="c12black1">[ <a href="files.php?id=<?=$work_id?>" class="c12black1">Back</a> ]</span>
</td>
</tr>
</form>
</table>
<script type="text/javascript"><!--
document.addfile.name.focus();
//--></script>
...
-
whiteadi
- PHPRomania Supporter
- Mesaje: 26
- Membru din: Joi Mar 04, 2004 12:25 pm
- Localitate: Timisoara
- Contact:
Dupa cum shtie calin vcare m-a ajutat, a mers, cu .htaccess cu:
<Limit GET POST>
php_value upload_max_filesize "100M"
</Limit>
php_value post_max_size "100M"
php_value memory_limit "100M"
php_value max_execution_time "600"
.htaccess care e pus in acelashi loc ca shi script-ul de upload.
Mercy again calin.
<Limit GET POST>
php_value upload_max_filesize "100M"
</Limit>
php_value post_max_size "100M"
php_value memory_limit "100M"
php_value max_execution_time "600"
.htaccess care e pus in acelashi loc ca shi script-ul de upload.
Mercy again calin.
Cine este conectat
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 22 vizitatori
