Onderwerp: upload script
Enkele bericht bekijken
Oud 9 January 2004, 21:46   #16
not-known
Guest
 
Berichten: n/a
Standaard

Citaat:
Originally posted by RandyJC
PHP Code:
<html>
<head>
<title>Nieuwe pagina 1</title>
</head>
<body>
<?
if ($_POST['action'] != 'upit') {
    
// hier de html voor het formulier
    
?>
    <form name=fileform method=post action=test.php enctype='multipart/form-data'>
        <input type='file' name='userfile'>
          <input type="submit" value="Verzenden" name="B1"></p>
          <input type='hidden' name='action' value='upit'>
    </form>
    <? 
$upload_mode 
= (@ini_get('open_basedir') || @ini_get('safe_mode')) ? 'move' 'copy'

$source_filename $_FILES['userfile']['name']; 

$destination_filename "/home/test/public_html/img/"$_FILES['userfile']['name']; 

switch (
$upload_mode

    case 
'copy'
        if ( !@
copy($source_filename$destination_filename) ) 
        { 
            if ( !@
move_uploaded_file($source_filename$destination_filename) ) 
            { 
                echo 
"er gaat toch iets mis.<br>"__LINE__

                exit; 
            } 
        } 
        @
chmod('./' $source_filename0666); 
        break; 

    case 
'move'
        if ( !@
move_uploaded_file($source_filename$destination_filename) ) 
        { 
            if ( !@
copy($source_file$destination_filename) ) 
            { 
                echo 
"er gaat toch iets mis.<br>"__LINE__

                exit; 
            } 
        } 

        @
chmod($config['upload_dir'] . '/' $destination_filename0666); 
        break; 


echo 
"Pakspul heerscht"
exit;

?> 
</body>
</html>
krijg nu deze fout.


Parse error: parse error in /home/virtual/site82/fst/home/test/public_html/test.php on line 56
maar als ik die exit weghaal dan nog steeds
je opent nou wel een if-statement:
if ($_POST['action'] != 'upit') {

maar je sluit hm zo te zien nooit meer dus ergens moet je nog een '}' invoegen. die plek is denk ik hier:
</form>
<?
}
$upload_mode = (@ini_get('open_basedir') || @ini_get('safe_mode')) ? 'move' : 'copy';
  Met citaat antwoorden