21. září bude sraz! Od 18.00 v restauraci Tradice v Praze u Anděla
Autor Zpráva
reiss
Profil
Mohl by mi nekdo rict proc 20 fotek se uploduje normalne a dalsich 20 se neuplouduje ? Sem fakt v koncich ,zadnou chybu nevidi ...prosim o radu :(
<?php
                $path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0];
                $path2= "upload/".$HTTP_POST_FILES['ufile']['name'][1];
                $path3= "upload/".$HTTP_POST_FILES['ufile']['name'][2];
                $path4= "upload/".$HTTP_POST_FILES['ufile']['name'][3];
                $path5= "upload/".$HTTP_POST_FILES['ufile']['name'][4];
				$path6= "upload/".$HTTP_POST_FILES['ufile']['name'][5];
				$path7= "upload/".$HTTP_POST_FILES['ufile']['name'][6];
				$path8= "upload/".$HTTP_POST_FILES['ufile']['name'][7];
				$path9= "upload/".$HTTP_POST_FILES['ufile']['name'][8];
				$path10= "upload/".$HTTP_POST_FILES['ufile']['name'][9];
				$path11= "upload/".$HTTP_POST_FILES['ufile']['name'][10];
				$path12= "upload/".$HTTP_POST_FILES['ufile']['name'][11];
				$path13= "upload/".$HTTP_POST_FILES['ufile']['name'][12];
				$path14= "upload/".$HTTP_POST_FILES['ufile']['name'][13];
				$path15= "upload/".$HTTP_POST_FILES['ufile']['name'][14];
				$path16= "upload/".$HTTP_POST_FILES['ufile']['name'][15];
				$path17= "upload/".$HTTP_POST_FILES['ufile']['name'][16];
				$path18= "upload/".$HTTP_POST_FILES['ufile']['name'][17];
				$path19= "upload/".$HTTP_POST_FILES['ufile']['name'][18];
				$path20= "upload/".$HTTP_POST_FILES['ufile']['name'][19];
				$path21= "upload/".$HTTP_POST_FILES['ufile']['name'][20];
                $path22= "upload/".$HTTP_POST_FILES['ufile']['name'][21];
				$path23= "upload/".$HTTP_POST_FILES['ufile']['name'][22];
				$path24= "upload/".$HTTP_POST_FILES['ufile']['name'][23];
				$path25= "upload/".$HTTP_POST_FILES['ufile']['name'][24];
				$path26= "upload/".$HTTP_POST_FILES['ufile']['name'][25];
				$path27= "upload/".$HTTP_POST_FILES['ufile']['name'][26];
				$path28= "upload/".$HTTP_POST_FILES['ufile']['name'][27];
				$path29= "upload/".$HTTP_POST_FILES['ufile']['name'][28];
				$path30= "upload/".$HTTP_POST_FILES['ufile']['name'][29];
				$path31= "upload/".$HTTP_POST_FILES['ufile']['name'][30];
				$path32= "upload/".$HTTP_POST_FILES['ufile']['name'][31];
				$path33= "upload/".$HTTP_POST_FILES['ufile']['name'][32];
				$path34= "upload/".$HTTP_POST_FILES['ufile']['name'][33];
				$path35= "upload/".$HTTP_POST_FILES['ufile']['name'][34];
				$path36= "upload/".$HTTP_POST_FILES['ufile']['name'][35];
				$path37= "upload/".$HTTP_POST_FILES['ufile']['name'][36];
				$path38= "upload/".$HTTP_POST_FILES['ufile']['name'][37];
				$path39= "upload/".$HTTP_POST_FILES['ufile']['name'][38];
                $path40= "upload/".$HTTP_POST_FILES['ufile']['name'][39];
				$path41= "upload/".$HTTP_POST_FILES['ufile']['name'][40];
				if ($HTTP_POST_FILES['ufile']['size'][0] > 0) 
				{
                copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][1] > 0) 
				{
                copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][2] > 0) 
				{
                copy($HTTP_POST_FILES['ufile']['tmp_name'][2], $path3);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][3] > 0) 
				{
                copy($HTTP_POST_FILES['ufile']['tmp_name'][3], $path4);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][4] > 0) 
				{
                copy($HTTP_POST_FILES['ufile']['tmp_name'][4], $path5);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][5] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][5], $path6);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][6] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][6], $path7);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][7] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][7], $path8);
				} // Show if recordset not empty 
                if ($HTTP_POST_FILES['ufile']['size'][8] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][8], $path9);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][9] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][9], $path10);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][10] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][10], $path11);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][11] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][11], $path12);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][12] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][12], $path13);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][13] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][13], $path14);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][14] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][14], $path15);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][15] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][15], $path16);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][16] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][16], $path17);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][17] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][17], $path18);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][18] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][18], $path19);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][19] > 0)
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][19], $path20);
				} // Show if recordset not empty
				if ($HTTP_POST_FILES['ufile']['size'][20] > 0)
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][20], $path21);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][21] > 0)
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][21], $path22);
				} // Show if recordset not empty 
				if ($HTTP_POST_FILES['ufile']['size'][22] > 0)
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][22], $path23);
				} // Show if recordset not empty
				if ($HTTP_POST_FILES['ufile']['size'][23] > 0)
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][23], $path24);
				} // Show if recordset not empty
				if ($HTTP_POST_FILES['ufile']['size'][24] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][24], $path25);
				} // Show if recordset not empty
				if ($HTTP_POST_FILES['ufile']['size'][25] > 0) 
				{
				copy($HTTP_POST_FILES['ufile']['tmp_name'][25], $path26);
				} // Show if recordset not empt


radas
Profil *
pokud to opravdu nic nepíše, neni omezeni na servru, že se můžou posilat data metodou POST jen do určite velikosti ?
Nox
Profil
používej $_POST a $_FILES
tvůj megaskript jde zkrátit na toto:

foreach($_FILES['ufile'] as $file)
  if ($file['size'][0] > 0)
    copy($file['tmp_name'][0], "upload/".$file['name']); 


jak píše radas, je možný že je to omezeno

máš někde error_reporting(E_ALL); ?
reiss
Profil
To bylo prvni co sem si myslel ,ale neni to tim ,, kdyz uploduju treba jen jednu fotku tak od 20tyho inputu to nejde ,prvnich 20 poziv uplne vpohode. A co fakt nechapu ze po odeslani to nehazi ani nulovou hodnotu do filesize... Script sem hodil i na jinej server (neplacenej) a tam to bezi jak ma ,,, a na nasem placenym jde jen pulka
reiss
Profil
tady je odkaz ten neplacenej http://realweb.tym.cz/upload.php ,,schvalne sem si oznacil bunky ad vidim ktery se uploadly a pozice 20 a vejs dou vpohode
radas
Profil *
ještě bych možna viděl problém v HTTP_POST_FILES nebo v copy, použil bych $_FILES['ufile'] (tak jak piše Nox) + move_uploaded_file
Nox
Profil
Ono by tam ani ty další proměnný neměly být když bys uploadoval 1 soubor...s tím co sem psal se vždycky provede tolikrát, kolik pošleš souborů

Plus co jsem psal využívá možnosti nepsat {} pokud následuje 1 příkaz/konstrukt, pokud bys chtěl něco doplnit - jako že bys měl, třeba kontrolu typu souboru, velikost aby se nepřesáhl limit atp. - tak je musíš dopsat
reiss
Profil
takle mam error
$filesize1=$HTTP_POST_FILES['ufile']['size'][0];
$filesize1 == 0) {
                	echo "<br>ERROR.....<br>";                    
                    if($filesize1==0) {echo "chyba;";}


a pri omezeni uploadu by to tu jednu fotku nahralo vzdycky.

no zkusim to prepsat podle vasich rad a uvidim,zatim diky
mckay
Profil
reiss:
Mimochodem, orientace v tvém kódu je nesnadná, příště zkus označit celý vložený kód a klepnout na . Pomůžeš tím diskutérům.

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0