Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class upload
- {
- function create_form($action,$submit){
- $form = '<center><p><form method="post" action="'.$action.'" enctype="multipart/form-data">
- </p><input type="file" size="40px" name="img"/>
- <input type="submit" value="'.$submit.'" />
- </form></center>';
- return $form;
- }
- function check ($tmp,$nom,$dos,$autoris)
- {
- $ext = strtolower(substr($nom,-3));
- if(in_array($ext,$autoris)){
- $randid = rand(1,1000000);
- $dosnom = $dos.$randid.".(MegaUpload)".$nom;
- move_uploaded_file($tmp,$dosnom);
- $valid = "Votre fichier a bien été uploadé.<br/>Vous pouvez visiter en <a href=\"".$dosnom."\">cliquant ici</a>. ";
- }
- else{
- $valid = "Votre fichier n'est pas supporté par notre serveur.";
- }
- return $valid;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment