hey im searching for a php code to upload file system by user. I found some on internet but im including that upload file within Contact Us form so can i include that uploading thing within the Php page i already have to send email
Printable View
hey im searching for a php code to upload file system by user. I found some on internet but im including that upload file within Contact Us form so can i include that uploading thing within the Php page i already have to send email
chek this one should do it.
http://us.php.net/manual/en/features...load.php#72064
ur looking for a contact form with an attachment tool on it?
to see if i can help u out.
Maybe this.... http://www.webcheatsheet.com/PHP/sen...hment.php#html
its not gonna be one line. use the code from that and modify your current file.
hmm never did this attachment before and i dont even want to mysql in this attachment here is the code in php and also tell me what to add in html file as well.
PHP Code:if(isset($_POST['submit'])) {
$to = "email";
$clientid = "13001";
$mail = "1";
$subject = $_POST['subject'];
$message = $_POST['message'];
$message1 = $_POST['message1'];
$body = "E-Mail: $mail\n Client Id: $clientid\n Comment:\n $message\n Suggestion:\n $message1";
echo "Email Sent";
mail($to, $subject, $body, "From: $mail");
} else {
echo "invalid!";
}
name the file as upfile.php
//name the file as upload_file.phpHTML Code:<html>
<body>
<form enctype="multipart/form-data" action="upload_file.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>
first you create a folder and name it as upload and this folder should be in the folder where the the above two programs is in ,and execute the program upfile.phpPHP Code:<?php
$target_path = "uploads/";
echo $target_path."<br>";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
bye
can I add this in my php code which i posted above
hai
the main goal is to upload the file ,for that purpose it is enough to use my code.but i cant understood your problem. do you want to upload the contactus page?
then by executing upfile.php you should browse the location of contactus page.
hai,
I cant understood ur problem
the main goal is to uplaod file.for that purpose it is enough to use my code .
first executing the upfile.php from that you can browse the contactus page
I have a CONTACT US PAGE... which uses PHP TO send EMAIL to me, i want to add an UPLOAD FILE field WITHIN THAT PHP file THAT im already using... do you understand now?
then please put the action from contactus page to upfile.php
or
you can also use the code with in contactus page by using include("upfile.php");
or
do you want to insert that code into your contactus page then copy the code and put in contactus page and use the text field names same means i used uploadedfile in upfile.php and it occurs 3 times in upload_file.php.if u want to change it then replace it in 3places.
hi i made this now and its not uploading..
PHP Code:if(isset($_POST['submit'])) {
$target_path = "uploads/";
echo $target_path."<br>";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$to = "email";
$clientid = "13001";
$mail = "1";
$subject = $_POST['subject'];
$message = $_POST['message'];
$message1 = $_POST['message1'];
$body = "E-Mail: $mail\n Client Id: $clientid\n Comment:\n $message\n Suggestion:\n $message1";
echo "Email Sent";
mail($to, $subject, $body, "From: $mail");
} else {
echo "invalid!";
}
please can anyone help me in this? i tried other scripts as well and no one is working..
bump...
hey you put in action in the form tag to upload_file.php
i specied above action="upfile.php " not to upload_file.php in contactus.php
<form enctype="multipart/form-data" action="upload_file.php" method="POST">
bump...
so no one is helping?