Results 1 to 3 of 3

Thread: Attach file already on the server?

  1. #1
    Join Date
    Apr 2008
    Posts
    5

    Default Attach file already on the server?

    I'm trying to find some way to use formmail.php to send a file that already exists on the server (as an EMail attachment), but haven't had any luck so far.

    I've tried using this code:

    Code:
    <input name="file" type="file" value="attach-test/test.pdf" />
    But rather than attaching the file, the text "attach-test/test.pdf" just ends up in the EMail. Any ideas?

    (In case anyone is wondering why someone would want to do this - I have a batch of PDF files that need to be sent out by EMail and I'd like to automate the process. I was thinking I could setup a database with fields for the filename & the recipient's EMail, then write a little PHP to send each file out)

  2. #2
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Attach file already on the server?

    Hi,

    For security, browsers don't allow you to set the value of a "file" field, and thereby automate an upload.

    Remember: an HTML form file field is an upload from the user's computer to the server.

    FormMail has all the code you need to send out emails with files attached from the server. Most of the code is in nice neat functions, but you're going to have to understand what you're doing to use the code.

    That's why god invented programmers.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #3
    Join Date
    Apr 2008
    Posts
    5

    Default Re: Attach file already on the server?

    Thanks, Russell - I figured that was the case.

    If anyone else is in the same boat, this code seems to do the trick (with a little modification):

    http://www.webcheatsheet.com/PHP/sen...attachment.php

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Don't Attach, Upload
    By Gomi in forum Features Questions
    Replies: 3
    Last Post: 20-Jan-2006, 08:46 PM
  2. Don't Attach, Upload
    By Gomi in forum FormMail Subscription Support
    Replies: 3
    Last Post: 20-Jan-2006, 08:46 PM
  3. File Attach Problem
    By slaxis in forum FormMail Subscription Support
    Replies: 2
    Last Post: 03-Dec-2005, 11:02 PM
  4. server error...?
    By kroggy in forum FormMail Subscription Support
    Replies: 1
    Last Post: 17-Nov-2005, 12:54 AM
  5. New Server
    By sectioni in forum FormMail Subscription Support
    Replies: 9
    Last Post: 21-Mar-2005, 02:07 AM

Bookmarks

Posting Permissions

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