last day (30 days later) » 

7:35 AM
0
A: Attachments not sent using php mail() function

ivionI hope it is just a typo. You are using the var $msg twice. Once for Your html-message and for the body of the message. <?php .... // Message body $msg = '<html><body><p>'; $msg .= '<b> Request Sent From : </b>' . $reqBy . '<br/>'; $msg .= '<b> Name : </b>' . $name . '<br/>...

 
yeah, i tried file is coming and fields also but the fields are coming with the html tags like <html><body><p>Name here<p></body></html> why this happen what is not working here. And when I downloaded the file type is file and an empty file is coming.
 
Did You remove the AddSlashes() from file_get_contents()? Try to add a space in Content-Type: text/html.
Your filename is always myfile. Try $filename = $_FILES["upload"]["name"];
 
yeah. I got it :) And now why the empty file is coming I upload pdf file with some content but when I download file type is file and the file is empty.
 
Try "Content-Type: ".mime_content_type ( $_FILES['upload']['tmp_name'] )."; name=\"".$filename."\"\r\n"; in Your attachment.
 
After add this $msgBody .= "Content-Type: ".mime_content_type ( $_FILES['upload']['tmp_name'] )."; name=\"".$filename."\"\r\n"; i'm getting trhis error mime_content_type(): Can only process string or stream arguments
 
7:35 AM
Did You upload a File. I edited the answer to check if file uploaded.
 
Yes file upload and getting mail also. when i downloaded the file and open inside file this content is coming Content-Type: ; name=""
 
Did the attachment work? Is it presented as the correct file type?
 
No showing file type is file.
 
Could You please make a Dump of print_r($_FILES["upload"])
 
@ivion getting this error syntax error, unexpected 'if' (T_IF)
 
7:42 AM
Try print_r('$_FILES["upload"]);
 
yes
 
Could You please show the output
 
@ivion getting this error mime_content_type(): Can only process string or stream arguments
 
No, show the out output of print_r($_FILES["upload"); It should show the content of an array
 
 
7:53 AM
Please show where you add print_r($_FILES["upload"]); It should be separate line to check if a file is uploaded
 
<?php
// Receiver mail id
$mail_to = 'husnak241@gmail.com';

// Mail Subject
$subject = 'Virtual Raasta';

$upload = $_FILES["upload"];
$path = 'assets/file';
$filename = 'myfile';

if ($_SERVER["REQUEST_METHOD"] == "POST") {

if ( isset($_POST['name']) ) {
$name = $_POST['name'];
}

if (isset($_POST['phone'])) {
$phone = $_POST['phone'];
}

if (isset($_POST['company'])) {
$company = $_POST['company'];
}

if(isset($_POST['message'])) {
$message = $_POST['message'];
}
if(isset($_POST['industry'])) {
 
It seem no file is uploaded. Does Your HTML code contain enctype="multipart/form-data"
 
@ivion yes enctype="multipart/form-data"
 
8:10 AM
Could You please check stackoverflow.com/questions/5147494/php-file-upload-problem if there are any problems?
 
8:52 AM
@ivion above code i tried this login here we need to move file inside `./assets/file` this folder file is not coming inside this folder. I had also tried a new code they i able to move the file but the problem is i'm unable to implement those logic in my code i tried but file is not coming. This is the logic for only file <?php
// request variables // important
$from = $_REQUEST["from"];
$emaila = $_REQUEST["emaila"];
$filea = $_FILES["filea"];
$to = 'yourmail@gmail.com';
$attachment = './assets/file';
 
Could You please check again if $_FILES is empty by dumping. Could You please check if uploads are enabled by Your php. You could do so by using phpinfo(); file_uploads have to be on.
 
9:40 AM
@ivion getting null
 
10:18 AM
So You have to set it to on. Try to change Your php.ini.
 
 
2 hours later…
12:27 PM
@ivion ok I'm working on the server.
 

  last day (30 days later) »