0

I have a classic form and an upload image input that allows visitors to enter details and one image.

<input type="text" id="first_name" name="first_name" maxlength="50">
<input type="file" id="image" name="image">

currently I store images on the client server and send just the image URL to the client email, but recently the folder reached the limit of 10MB and no further images uploads were possible and further emails failed submission too.
I tried for a long time to somehow send the form with an uploaded image the the client email, without storing it server side but with no success. Googled all around and tried lot of suggestions - I was just able to send the form but with no image attached to it. What can I do?

2 Answers 2

1

You should be able to get the binary contents of the image with file_get_contents($image) using the tmp location when you submit the form and then use that data in the e-mail. The approach to display in the e-mail will vary depending on if you are using html e-mails or not.

This link may help php: recreate and display an image from binary data

Sign up to request clarification or add additional context in comments.

Comments

1

It is not possible to attach a file to an e-mail without first storing it on the server.

You may consider using a service such as Amazon S3 to host the files. That way, you don't have to handle the files and you can still e-mail the URLs, which makes everyone happier.

Alternatively, you may be able to find a service such as ImageShack that provides an API to upload pictures to.

Good luck!

4 Comments

+1 Thanks for your fast answer! The client is concerned about privacy, and I was trying to not pay some 3rd parties for upload services...
All I can say is find a better server :/ 10MB is an extremely small amount of space.
Without any extra information, I'm not sure. Amazon EC2 offers a free 612MB RAM server free (not sure how many gigs of storage) for one year. If you have experience with Linux servers, you may want to give it a try.
Thank you! I'll leave this topic opened a bit before accepting. Thanks! I'm really out of imagination how to solve this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.