i try to puth the files path in a mail for download it without ftp
$nomecognome = $_POST['cname'];
$email = $_POST['cemail'];
$biography = $_POST['ctext'];
$datanascita = $_POST['cdata'];
$controllo = $_POST['ccontrol'];
$files = $_FILES['uploader'];
if(empty($controllo)){
i clear the name
$accenti = array( 'à' , 'è' , 'é' , 'ì' , 'ò' , 'ù' , '\'' , ' ' );
$noaccenti = array( 'a' , 'e' , 'e' , 'i' , 'o' , 'u' , '_' , '_' );
$author = strtolower( str_replace( $accenti , $noaccenti , $nomecognome ) );
create an array for future comparison file ext
$allowedExtensions = array('jpg', 'jpeg', 'png', 'bmp', 'tiff', 'gif', 'pdf');
control if the form is empty
if ( !empty ( $files ) ){
start uploading images
foreach ($files['name'] as $key => $value) {
if(is_uploaded_file($files['tmp_name'][$key]) && $files['error'][$key] == 0) {
Create an unique name for the file using the name of user and random number plus filename
$filename = $files['name'][$key];
$filename = $author.rand(0,99).$filename;
//array_push($path, 'http://www.magic-promo.it/uploads/'.$author.$value);
Check if the file was moved
if( move_uploaded_file( $files['tmp_name'][$key], 'uploads/'. $filename) ) {
here i want to create the array ith each image path to send mail
foreach ($filename as $filenames) {
$pathfile[] = array($filename);
}
$body = implode(',', $pathfile);
echo $body; //to view the list of path
}
else{
echo move_uploaded_file($files['tmp_name'][$key], 'uploads/'. $filename);
echo 'file non uploadato';
}
}
else {
echo 'The file was not uploaded.';
}
}
i thanks for the help!
foreach ($filename as $filename) {
is not a valid PHP syntax. Change the second$filename
to a different variable.