upload systeem

Gestart doorOne2xs3 reacties52 weergaven

4 berichten · pagina 1 van 1

One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
ik ben bezig met een upload systeem maar hoe haal ik het bestand door een md5 ofzoiets?
dus als je hoi.gif upload dat er van word gemaakt: fhdmf94jmf9d4.gif
code van het upload systeem:

[COLOR= #0000BB]<?PHP[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700])){[/COLOR] 
[COLOR= #0000BB]$locatie[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"uploads/"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"http://83.84.195.228/uploaden/$locatie"[/COLOR][COLOR= #007700];[/COLOR]
   [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/is_uploaded_file"]is_uploaded_file[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeelding[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]tmp_name[/COLOR][COLOR= #007700]])) 
   {[/COLOR] 
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeelding[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]size[/COLOR][COLOR= #007700]]>[/COLOR][COLOR= #0000BB]9999[/COLOR][COLOR= #007700]) 
                   {[/COLOR] 
                   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Het bestand is te groot"[/COLOR][COLOR= #007700];[/COLOR] 
                   [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]; 
                   }[/COLOR] 

        [COLOR= #FF8000]//controleer extensie, voeg maar andere toe [/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/eregi"]eregi[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"((.gif|.jpg|.png)$)"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeelding[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]])) 
                   {[/COLOR] 
                   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"het bestand is niet van het juiste type"[/COLOR][COLOR= #007700];[/COLOR] 
                   [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]; 
                   }[/COLOR] 


        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/move_uploaded_file"]move_uploaded_file[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeelding[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]tmp_name[/COLOR][COLOR= #007700]],[/COLOR] 
                               [COLOR= #0000BB]$locatie[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeelding[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]])) 

                  {[/COLOR] 
                  [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]" het plaatje / bestand kan niet worden geupload"[/COLOR][COLOR= #007700];[/COLOR] 
                  [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]; 
                  }[/COLOR] 

                  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"je plaatje is geupload.<br>"[/COLOR][COLOR= #007700];[/COLOR]
                  [URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"includes/geupload.php"[/COLOR][COLOR= #007700]);
   }[/COLOR] 
     
   [URL="http://www.php.net/else"]else[/URL] 
   [COLOR= #007700]{[/COLOR] 
   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Het uploaden is helaas mislukt"[/COLOR][COLOR= #007700]; 
   } 
     

}[/COLOR] 
[URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR] 
?> 
     <form method="post" action="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]];[/COLOR] ?>" enctype="multipart/form-data"> 
     <input type="file" name="afbeelding"><br>
     <input type="submit" name="submit" value="uploaden"> 
     </form> 
[COLOR= #0000BB]<?php[/COLOR] 
     [COLOR= #007700]}[/COLOR] 
?>


en de code van geupload is niks dat je het vast weet yummie
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
BUMB!
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
We hebben denk ik geupload nodig, want hier kan ik niet veel uithalen yummie
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
code geupload.php:



EDIT: daar staat dus niks yummie
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren