up.class.php?? phpclassup (public$f;//represents $?FILES?xx?public$$s;/upload file size public$$n;/whether to specify the file name public$$d;/whether to specify a folder function?construct f, $s s 1, $n, faux, $d
up.class.php (en)
f-$f; $this-s-$s-1000000; $this-n-$n; $this-d-$d; $this -sgt;sloading;; charge de fonction()$this-fsize(); $this-and-ftype(); $this-gt;fmv (); la fonction fname() ($this-n)) $this-et-et-$this ftype(); else.return time.rand (111 999)$this-ftype(); fonction fdir() ($this-d)//déterminer si l'utilisateur spécifie le nom du dossier si (!?is-dir($this-gt;d))//déterminer si le nom du dossier spécifié existe mkdir ($this--d); retour $this-d." /"; ("date")) ("date") ( "date") ) ) ( " date de retour ("Ymd") /"; fin fdir fonction fsize() ( si ($this-?gt; $this f? d'autre retour vrai; fonction ftype() switch ($this-?type') cas "image/x-png": $ok ".png"$ok; break; cas "application/pdf": $ok ".pdf"; break; case "image/pjpeg": $ok"".jpg"$ok; break; cas "image/jpg": $ok ".jpg"; break; default: $ok?false; si ($ok) $ok; l'écho d'autre "type de fichier est incorrect"; fonction fmv() ( déplacer - fichier téléchargé) ($this-'tmp?name'), $this--et-fdir($this-et-fname()); ?? test.php fichier de téléchargement $v) (nouveau ($.FILES , $id) ?