Premetto che col php sono davvero una frana, stò cercando di crare uno script prendendo vari pezzi di codici già pronti, ho creato un form:

Codice PHP:
<?php echo "<form action=\"wp-admin/upload.php?rel_path=$rel_path&amp;action=upload\"; ?>
Però quando vado a caricare una foto e il form lancia il file upload.php, ho questo errore:

Parse error: syntax error, unexpected $end in upload.php on line 132

L'errore è sull'ultima riga, la funzione è giusta perchè l'ho presa da uno script in cui funziona, io credo che non mi prenda l' action dal form, $_REQUEST non sò manco cosa sia

Codice PHP:
<?php

if($_REQUEST['action'] == "upload"){
echo 
"<span class='highlight'>";

//if (!get_settings('use_fileupload')){ //Checks if file upload is enabled in the config
// echo (__("The admin disabled this function"));
if (!current_user_can('upload_files')){
echo(
__('You do not have permission to upload files.'));
}
else {
//$upl_path = get_settings('fileupload_realpath').$rel_path;
$upl_path ABSPATH.'/'.get_settings('upload_path').$rel_path;
if (!
is_writable($upl_path)){
//printf(__("It doesn't look like you can use the file upload feature at this time because the directory you have specified (<code>%s</code>) doesn't appear to be writable by WordPress. Check the permissions on the directory and for typos."), get_settings('fileupload_realpath').$rel_path);
printf(__("It doesn't look like you can use the file upload feature at this time because the directory you have specified (<code>%s</code>) doesn't appear to be writable by WordPress. Check the permissions on the directory and for typos."), ABSPATH.'/'.get_settings('upload_path').$rel_path);
}
else {
$allowed_types explode(' 'trim(strtolower($imagesallowed)));
$img1_name $HTTP_POST_FILES['upl_file']['name'];
$img1 $HTTP_POST_FILES['upl_file']['tmp_name'];

$imgtype explode(".",$img1_name);
$imgtype strtolower($imgtype[count($imgtype)-1]);
//check that this is an image, no funnybusiness
$checkthatimage getimagesize($img1);
if (
$checkthatimage == FALSE) {
unlink($img1);
die (
__("Not a valid image file."));

}

//end check

if (in_array($imgtype$allowed_types) == false) {
echo 
sprintf(__('File %1$s of type %2$s is not allowed.') , $img1_name$imgtype);
}
else {
//file type is allowed
if( $HTTP_POST_FILES['upl_file']['size'] > ($maxuploadsize*1024))
echo 
__("File is larger than allowed limit!");
else {
//filesize is OK
if($HTTP_POST_FILES['upl_file']['size'] > 0){//larger than 0 is allowed:o)
?? $pathtofile2 $upl_path.$img1_name;
if(
file_exists($pathtofile2)){
printf(__("The filename '%s' already exists!"), $img1_name);
}
else {
//let's move the file
$moved move_uploaded_file($img1$pathtofile2);
// if move_uploaded_file() fails, try copy()
if (!$moved) {
$moved copy($img1$pathtofile2);
}
if (
$moved) {
printf(__("Couldn't upload your file to %s."), $pathtofile2);
} else {
chmod($pathtofile20666);
@
unlink($img1);
}

}

}
//doesn't exist
}//>0
}//<maxSize

}

}

}
echo 
"</span>";
}

else {
echo 
"hallo";
}

?>