Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    May 2013
    Posts
    8
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Exclamation Email attachment form

    Hi! I have an email form and I need to add the option of attachments to it. If possible I would like for the attachments (up to 10) to be uploaded to a folder and for the email to send the file names along with the rest of the information from the form. This means that there should also be a way to automatically rename the pictures so that they don't replace pictures already in the folder.

    If this is too complicated, then as an alternative I would like to add the attachment options to the email form so that it sends the pictures along with the rest of the information. Also, the email form currently sends codes, no any method used to send it (if it must absolutely be remade) should be able to handle sending code. I prefer the first option, but I'll settle for the second if the first is not possible. Thanks for your help!

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,396
    Thanks
    8
    Thanked 1,078 Times in 1,069 Posts
    How large are the photos (filesize / bytes)?

  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,093
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Quote Originally Posted by mlseim View Post
    How large are the photos (filesize / bytes)?
    How long is a piece of string?

    There is no real answer to your question mlseim as the file sizes can vary with each use.

    As for the original question, this sounds more like someone wanting a tutorial / do it for me request. It really needs to go in the project requests forum i think.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • Users who have thanked tangoforce for this post:

    Milia (08-08-2013)

  • #4
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,396
    Thanks
    8
    Thanked 1,078 Times in 1,069 Posts
    There could be a reason for me to ask about the photo filesizes ... If the author does wedding photos or other really hi-res photos, the sizes for each photo could be like 5MB+. Attaching 10 those could become an issue. But if the photos were 200-500KB each, that would change the dynamics of it.

    The next question I'll be asking is, "why do the photos need to be emailed?"

    Why not upload them to the server and let the user(s) view them by logging in? The user can decide whether or not to download them to their PC.

  • Users who have thanked mlseim for this post:

    Milia (08-08-2013)

  • #5
    New to the CF scene
    Join Date
    May 2013
    Posts
    8
    Thanks
    6
    Thanked 0 Times in 0 Posts
    They are animal photos and they could come in a variety of sizes. If it really has a big effect I could request for the photos not to be larger than a certain size, though it should be large enough for it to accept most picture commonly taken by digital cameras in their regular settings...

    Uploading the photos to the server is fine, but I would need the email to have their file names to know which photos correspond to what message and also for to account for the possibility of people uploading photos with the same file name.

    Here's the code I use:
    Code:
     <?php 
    
    $sraza = $_POST['uraza']; 
    
    $scost = $_POST['ucost']; 
    
    $sname = $_POST['uname']; 
    
    $smail = $_POST['umail']; 
    
    $setel = $_POST['urtel']; 
    
    $stown = $_POST['utown']; 
    
    $stalk = $_POST['utalk']; 
    
    $to = 'email goes here (I removed it)';
    
    $email_subject = "Shop";
    	
    $email_body = "<!-- START --> \n <!-- Replace 000 with a number up to 100 and set the expiration date. --> \n \n <?php \$dogid = \"000\"; \n \n \$exp_date = \"2000-01-25\"; \n \n \$todays_date = date(\"Y-m-d\"); \$today = strtotime(\$todays_date); \$expiration_date = strtotime(\$exp_date); \n if (\$expiration_date < \$today) { \$show = \" style=\\\"display:none;\\\"\"; } \n else { \$show = \" style=\\\"display:block;\\\"\"; } ?> \n <div id=\"p<?php echo \$dogid; ?>\"<?php echo \$show; ?>> <div class=\"schnauzer\"> \n <?php \$dir = \"image/\" . \$dogid . \"/\"; \$images = scandir(\$dir); \$i = rand(2, sizeof(\$images)-1); ?> \n <img src=\"image/<?php echo \$dogid; ?>/<?php echo \$images[\$i]; ?>\" alt=\"\" class=\"preview\" /> \n <br /><span class=\"idnum\">ID #: </span> <?php echo \$dogid; ?> \n <br /><span class=\"fotos\"><a href=\"pics.php?page=<?php echo \$dogid; ?>\">Ver mas fotos</a></span> \n \n <br /><span class=\"raza\"> Raza: $sraza </span> \n <br /><span class=\"precio\"> $scost </span> \n <br /><span class=\"nombre\"> $sname </span> \n <br /><span class=\"pueblo\"> $stown </span> \n <br /><span class=\"telefono\"> $setel </span> \n <br /><span class=\"email\"> $smail </span> \n <br /><span class=\"precio\"> $stalk </span> \n </div></div> \n \n <!-- END --> \n"; 
    	
    mail($to,$email_subject,$email_body);
    	
    header('Location: anuncio.php'); ?>
    This sends the code fine, so it serves its purpose, I would like for the photo file names to be sent along with this message. So basically, I would need to be able to have people transmit this message and upload the photos through the same form and for it to detect and send the photo file names, if that's even possible... Sorry if it sounds confusing, please let me know if you understand what I'm trying to say and thank you for taking the time to read this.

  • #6
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,396
    Thanks
    8
    Thanked 1,078 Times in 1,069 Posts
    Does anyone need to log-in for uploading photos? Or can anyone (including spammers) upload whatever they want? What are the security issues here, and how secret do the photos need to be?

    Maybe if you describe what you're doing, that might help us.

    I realize that I'm not directly answering your original question. I'm thinking that depending on what you're really trying to do will result in different answers.

  • Users who have thanked mlseim for this post:

    Milia (08-10-2013)

  • #7
    New to the CF scene
    Join Date
    May 2013
    Posts
    8
    Thanks
    6
    Thanked 0 Times in 0 Posts
    No one needs to log in and anyone can view the photos, as they will be posted to the site after approval anyway, it's a pet gallery. No security issues I can think of, the end result is pretty simple, it's just this step that I'm stuck on.

  • #8
    New to the CF scene
    Join Date
    May 2013
    Posts
    8
    Thanks
    6
    Thanked 0 Times in 0 Posts
    I managed to get it working with some help from another forum. thanks for your replies everyone!

  • #9
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,093
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Quote Originally Posted by mlseim View Post
    There could be a reason for me to ask about the photo filesizes ... The next question I'll be asking is, "why do the photos need to be emailed?"
    And then this happens

    Quote Originally Posted by Milia View Post
    I managed to get it working with some help from another forum. thanks for your replies everyone!
    @mlseim: Thats what happens when you answer questions with non-essential questions instead of getting to the point. Either someone else gets there first, or the op goes and gets help elsewhere and someone else gets there first
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •