mam taki problem, probuje zrobic upload plikow, który bedzie na "upload_files.php?screen=upload".
Mam taki kod:
switch($_GET['screen']) { case 'upload': $target_dir = "uploads/"; $uploadOk = 1; // Check if image file is a actual image or fake image if($check !== false) { $uploadOk = 1; } else { $uploadOk = 0; } } // Check if file already exists $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 500000) { $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) { $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { // if everything is ok, try to upload file } else { } else { } } break; default: break; }
Kod na upload z w3school.com.
I formularz w HTML:
Bez instrukcji switcha działa bezproblemowo, czyli dochodze do wniosku, ze cos koliduje miedzy $_GET a $_POST. Jest moze jakas alternatywa do tego?