[PHP] Ik snap het niet meer!

Gestart doorSkytop5 reacties18 weergaven

6 berichten · pagina 1 van 1

Skytop

Lid · Topicstarter

Berichten
1.101
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo One2xs,
Ik was weer bezig met PHP. biggrin
Nou ja, ik volgde een tutorial van PHPAcademy op Youtube.
Ik had een script nodig en ik schreef alles netjes over, Maar ik weet niet hoe het moet ik krijg steeds deze errors:

Warning: move_uploaded_file(data/thumbs/) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/kqownzkq/domains/animefan.nl/public_html/ingelogd/manga/upload.php on line 14

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move /tmp/php7hcHPW to data/thumbs/ in /home/kqownzkq/domains/animefan.nl/public_html/ingelogd/manga/upload.php on line 14

Wat wil ik?
Ik wil dat je met 1 file te uploaden het meteen in 2 verschillende folders (mappen) word geplaatst.

Het mag alleen een foto zijn, geen movie, php file, enz..

Wat ik nu heb:

[COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]image[/COLOR][COLOR= #007700]])) {[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
        
    [COLOR= #0000BB]$file_name[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]images[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$file_size[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]image[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]size[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$file_tmp[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]image[/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]$file_size[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]2097152[/COLOR][COLOR= #007700]){[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]"File size must be under 2 Megabytes."[/COLOR][COLOR= #007700];
     }[/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]$errors[/COLOR][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]$file_tmp[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]data/thumbs/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$file_name[/COLOR][COLOR= #007700])){[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"File Uploaded in <b>THUMBS</b>, click <a href=upload2.php>here</a> for upload it in folder Album to display the image.s"[/COLOR][COLOR= #007700];
        }
     }[/COLOR] [URL="http://www.php.net/else"]else[/URL]
        [URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$error[/COLOR][COLOR= #007700]){[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$error[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
        }
}[/COLOR]
?>

<form action="" method="POST" enctype="multipart/form-data">
    <p>
        <input type="file" name="image" />
        <input type="submit" value="Upload" />
    </p>
</form>


Skytop
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Skytop

Lid · Topicstarter

Berichten
1.101
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oh! Wat een beginnersfout. Images geschreven i.p.v Image. Nu werkt het weer!
Alleen upload ik het 2x.

1x voor de 1e map.1x voor de 2e map.
Weet iemand hoe je met 1x iets te uploaden het in 2 mappen kan zetten?
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het kopieren van de ene in de andere map?
Waarom zou je dat willen trouwens?
0
Skytop

Lid · Topicstarter

Berichten
1.101
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Alemaalte schreef:
Het kopieren van de ene in de andere map?
Waarom zou je dat willen trouwens?
Ik snap niet echt hoe het komt dat het moet, maar je moet de file in thumbs & album uploaden voordat image werkt.
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Leg even uit waarom je dat moet.
En kopieer ze gewoon?
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