![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Feb 2002
Location: South Lake Tahoe, CA
Posts: 1,099
|
please help me with simple php
can someone help me add file types to my upload script please?
current it checks for jpeg and errors if it's not that one type: if ($type == "image/jpeg"){ i want to add supported file types so i've changed it to: if ($type == "image/jpeg") || ($type == "image/jpg") || ($type == "image/gif") || ($type == "image/psd") || ($type == "image/tiff") || ($type == "image/bmp") { but it's not happy...
__________________
HIGH QUALITY ADULT AND NON-ADULT DESIGN/MARKETING WORK SINCE 1997!! Yan - ICQ # 4790444 - Phone: 530-544-7058 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
So fuckin' bored
Industry Role:
Join Date: Jun 2003
Posts: 32,384
|
That should work, but it depends on what exactly is stored in $type variable.
__________________
Obey the Cowgod |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Sep 2002
Posts: 1,209
|
PHP Code:
__________________
Awesome cloud hosting by DigitalOcean |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
MOBILE PORN: IMOBILEPORN
Join Date: Jan 2004
Location: Tinseltown NL
Posts: 16,502
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Feb 2002
Location: South Lake Tahoe, CA
Posts: 1,099
|
$type = $_FILES['filename']['type'];
__________________
HIGH QUALITY ADULT AND NON-ADULT DESIGN/MARKETING WORK SINCE 1997!! Yan - ICQ # 4790444 - Phone: 530-544-7058 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
So fuckin' bored
Industry Role:
Join Date: Jun 2003
Posts: 32,384
|
Should be working then. Are you getting any error message?
__________________
Obey the Cowgod |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Feb 2002
Location: South Lake Tahoe, CA
Posts: 1,099
|
thanks for your help!
here's the page it's on and the error: http://www.cheaptrace.com/contact.html Parse error: parse error, unexpected T_BOOLEAN_OR in /home/httpd/cheaptrace.com/html/sendmail.php on line 58 here's the whole script: <?php session_start(); if ($_POST["vercode"] != $_SESSION["vercode"] OR $_SESSION["vercode"]=='') { echo '<strong>Incorrect verification code.</strong><br>'; die; } else { if ($_SERVER['REQUEST_METHOD']=="POST"){ $sendername = $_POST['name']; $from = $_POST['mail']; $senderphone = $_POST['phone']; $sendercountry = $_POST['country']; $filename = basename($_FILES['filename']['name']); $ext = substr($filename, strrpos($filename, '.') + 1); $notes = $_POST['remarks']; $to="[email protected]"; $subject="Cheap Trace"; /*$from = stripslashes($_POST['fromname'])."<".stripslashes($_POST['fromemail']).">";*/ $mime_boundary="==Multipart_Boundary_x".md5(mt_ran d())."x"; $tmp_name = $_FILES['filename']['tmp_name']; $type = $_FILES['filename']['type']; $name = $_FILES['filename']['name']; $size = $_FILES['filename']['size']; $message = "Filename: $name\n"; $message .="type: $type\n"; $message .="size: $size\n\n"; if (file_exists($tmp_name)){ if(is_uploaded_file($tmp_name)){ $file = fopen($tmp_name,'rb'); $data = fread($file,filesize($tmp_name)); fclose($file); $data = chunk_split(base64_encode($data)); } $message .= "Name: "."$sendername\n"; $message .= "Country: "."$sendercountry\n"; $message .= "EMail Address: "."$from\n"; $message .= "Telephone: "."$senderphone\n\n"; $message .= "Remarks: "."$notes\n\n"; $headers = "From: $from\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; $message .= "--{$mime_boundary}\n" . "Content-Type: {$type};\n" . " name=\"{$name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; if ($type == "image/jpeg") || ($type == "image/jpg") || ($type == "image/gif") || ($type == "image/psd") || ($type == "image/tiff") || ($type == "image/bmp") { }else{ echo "The file is not a supported file type: jpeg, jpg, gif, psd, tiff or bmp"; die; } if (@mail($to, $subject, $message, $headers)) echo "Your request has been sent.<br>"; else echo "Failed to send"; } } else { ?> <meta http-equiv="refresh" content="2;URL=contact.html"> <?php } } ?>
__________________
HIGH QUALITY ADULT AND NON-ADULT DESIGN/MARKETING WORK SINCE 1997!! Yan - ICQ # 4790444 - Phone: 530-544-7058 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Confirmed User
Industry Role:
Join Date: Sep 2002
Posts: 1,209
|
Quote:
if ($type == "image/jpeg" || $type == "image/jpg" || $type == "image/gif" || $type == "image/psd" || $type == "image/tiff" || $type == "image/bmp")
__________________
Awesome cloud hosting by DigitalOcean |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Aug 2004
Location: Barcelona
Posts: 1,022
|
^ absolutely correct.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Join Date: Feb 2002
Location: South Lake Tahoe, CA
Posts: 1,099
|
sweet thanks guys
__________________
HIGH QUALITY ADULT AND NON-ADULT DESIGN/MARKETING WORK SINCE 1997!! Yan - ICQ # 4790444 - Phone: 530-544-7058 |
![]() |
![]() ![]() ![]() ![]() ![]() |