Jump to content

Landingpage Upload Image and rename it


iNoize
 Share

Recommended Posts

Hello, 

i have a landingpage and need to reaname the images or save it to the filed images in the userpage 

i have this script currently 

 

                   if(isset($input->post->submit)) {  
              $lptitle     = $sanitizer->text($input->post->lptitle);  
              $anrede    = $sanitizer->text($input->post->anrede);
              $first_name       = $sanitizer->text($input->post->first_name);
              $last_name       = $sanitizer->text($input->post->last_name);
              $str       = $sanitizer->text($input->post->str);
              $num      = $sanitizer->text($input->post->num);
              $plz      = $sanitizer->text($input->post->plz);
              $ort      = $sanitizer->text($input->post->ort);
              $land      = $sanitizer->text($input->post->land);
              $email      = $sanitizer->text($input->post->email1);
              $fbname      = $sanitizer->text($input->post->fbname);



                        if ($page->id == '2328' ) {

         
         // Set a temporary upload location where the submitted files are stored during form processing
              $upload_path = $config->paths->assets . "files/stickers/";

              // New wire upload
$file = new WireUpload('file'); // References the name of the field in the HTML form that uploads the photo
$file->setMaxFiles(1);
$file->setOverwrite(false);
$file->setDestinationPath($upload_path);
$file->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif'));

// execute upload and check for errors
$files = $file->execute();





           //   echo "Passt";



                        }


              // $group     = $sanitizer->text($input->post->group2);

              if ($sanitizer->text($input->post->group2) == "on") {
              $group     =    "1";
              }else{
                  $group     =   "0";
              }
              


                    $mail = \ProcessWire\wiremail();

                    $mail->to($email)->from("mymailhere@domain.com");
                    $mail->subject("Deine Anmeldung zur $page->title !");


   $mail->bodyHTML("Hey $first_name,<br>
<br>
deine Anmeldung zur <b style='color: #4fc3f7;'>$page->titleaktion</b> war erfolgreich.<br>
$page->mailoben

Deine Angaben:<br>
$anrede $first_name $last_name<br>
$str $num<br>
$land - $plz $ort<br>
$email<br>
$fbname<br>
<br>
Wir wünschen dir auf jeden Fall schonmal viel Erfolg und erfrischende Grüße!<br>
$page->mailunten
Gerne kannst du auch deinen Freunden von unserer $page->titleaktion per Facebook, Twitter, Google+, WhatsApp oder E-Mail berichten:<br>");

                     $mail->send();

 $p = new Page(); // create new page object
 $p->template = 'fans'; // set template
   $p->parent = $page->id;

  $p->title = $first_name." ".$last_name."-".$page->numChildren; 

 $p->gender = $anrede; 
 $p->first_name = $first_name; 
 $p->last_name = $last_name; 
 $p->str = $str; 
 $p->num = $num; 
 $p->plz = $plz; 
 $p->ort = $ort; 
 $p->land = $land; 
 $p->email = $email; 
 $p->fbname = $fbname; 
 $p->letter = $group; 


 $p->save();
 $p->images = $upload_path . $files[0];
 $p->save();
 @unlink($upload_path . $files[0]);


   }

How to save the Image to the Userpage  ? 

 

Thanks 

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...