php - Email $_FILES['name'] as list -


After a user uploads multiple files, I display files uploaded to the screen. I am also trying to include the same list in an email body. Everything works perfectly, including displaying each file on the screen, leaving the $ message, only lists the last file name in the array. Any ideas ??

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Uploads & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt ;? Php if (isset ($ _ POST ['ship-it']) and $ _POST ['ship-it'] === "yes") {$ yesupload = $ _POST ['ship-it']; Preg_match ("/ yes /", "". $ Yesupload. ""); ($ I = 0; $ i & lt; calculation ($ _ files ['tray'] ['name']); $ i ++} {$ filename = $ _FILES ['tray'] ['name'] [ $ I]; $ S_name = $ _FILES ['tray]] [' tmp_name '] [$ i]; Move_uploaded_file ($ s_name,' https://example.com/inbox/'filename. '');} $ Info = $ _SERVER ['HTTP_USER_AGENT']; $ Message_body = "". $ _ POST ["email"]. "File uploaded:" $ _ FILES ['tray]' ['name']. "Https: / /example.com/inbox/".rawurlencode($ file name). "User Agent:". $ _ POST ["id"]. "". $ Info. "" $ Mail_options = ['Sender' = & gt; ; 'Sender@gmail.com', 'to' = & gt; 'Receiver@gmail.com', 'Subject' = & gt; 'New File Sent', 'Text Body' => $ Message_ac]; { Try $ Message = new message ($ mail_options); $ message & gt; Ege ();} grip (invalid acceptance exception $ e) {echo 'error:';} echo " p> all done here   $ I = 0; $ i & lt; Count ($ _ files ['tray'] ['name']); $ i ++) {echo "and lit.U style = 'list-style-type: square' & Gt; & lt; li & gt; {$ _ files ['tray'] ['name'] [$ i]} & lt; / Li & gt; & Lt; / Ul & gt; ";}}? & Gt; & lt; form action =" & lt ;? Php echo $ upload_url? & Gt; "Method =" post "enctype =" multipart / form-data "& gt; & lt; p & gt; Files to upload: & lt; / p & gt; & lt; br & gt; Input type = "hidden" name = "ship-it" value = "yes" & gt; Php echo $ _SERVER ['REMOTE_ADDR']? & Gt; "& gt; input type =" email "name =" email "required =" autofocus placeholder = "your email address" & gt; & lt; br & gt; & lt; br & gt; Input type = "file" multiple name = "tray []" required = "" & gt; & lt; input type = "submit" value = "upload" & gt; & lt; br & gt;     

You already have a loop that displays the file name on the web page. You stored the file names in the $ message_body You need to have a similar loop in order to get it uploaded to the loop already. Perhaps something like this:

  $ message_body = "". $ _ POST ["Email"]. "Uploaded these files: \ n"; ($ I = 0; $ i & lt; calculation ($ _ files ['tray'] ['name']); $ i + +} {$ Filename = $ _FILES ['tray'] ['name'] [$ i]; $ S_name = $ _FILES ['tray]] [' tmp_name '] [$ i]; Move_uploaded_file ($ s_name,' https : //example.com/inbox/'filename. ''); $ Message_body = "*" $ _FILES ['tray]] [' name '] [$ i] "- & gt; https://example.com/inbox/" CrudeLencode ($ filename) "\ N"; }  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -