Tuesday, March 19, 2013

Re: Retrieve attachment from a Post - mailgun



You have not shown you code properly, as much as i am understanding you might be using ajax for submission of forms. Are you Posting form using Ajax??? If it is, then i will suggest you that ajax based form posting does not support file upload

On Tue, Mar 19, 2013 at 10:56 PM, MDay <mdaytrades@gmail.com> wrote:
hi there - hoping someone can help me with a simple issue I have having with retrieving data from an HTTP Post.   I am using mailgun to post an email message to a simple method in my application...  Everything is working correctly except I can't get attachments out of the POST.  I noticed that the encoding is set as multipart/form-data and the support guys at mailgun indicated I had to use $FILES to retrieve the data from the post.   I am a bit of a newbie, so now I am lost..

Here is what my current code looks like:

$subject = $this->request->data('subject');   //THIS WORKS

$attachement_test1 = $this->request->data($_FILES['attachment-1']);  //THIS DOESN'T WORK

$attachement_test2 = $this->request->data('attachment-1');//THIS DOESN'T WORK EITHER

$this->log("New Message");

$this->log($subject);

$this->log($attachement_test1);

$this->log($attachement_test2);


Snip from the mailgun docs:


attachment-x string attached file ('x' stands for number of the attachment). Attachments are handled as file uploads, encoded as multipart/form-data.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: