Using PHP with a file transfer

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
target2021
Forum Newbie
Posts: 1
Joined: Mon Oct 19, 2009 8:50 am

Using PHP with a file transfer

Post by target2021 »

Thank you for taking the time to read my post. Let me begin by saying that I am a novice so please take that into consideration when responding. I have a website that has been worked on by a professional developer and myself.

I presently have a form where my customers can submit contact information, Name, Address, etc. I would like to add the ability for these people to attach a file, EPS, PDF, JPEG, etc. with their submission.

The form presently uses PHP as the method of transferring the information. Can anyone help me with the code for adding a field using PHP that would allow my customers to submit a file with their information?

I don't use a database of any sort for these submissions, the information is sent to an email address.

Any help would be greatly appreciated.

Thank you,

Mike
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Using PHP with a file transfer

Post by pickle »

Do a Google search for "PHP HTTP File Uploads". There's a really helpful tutorial on the PHP documentation website that should pop up. That'll show you how to transfer the file from the client to your server.

I'd recommend using SwiftMailer for sending your email. It will drastically simplify the work of attaching a file to an email.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
N1gel
Forum Commoner
Posts: 95
Joined: Sun Apr 30, 2006 12:01 pm

Re: Using PHP with a file transfer

Post by N1gel »

You will want to upload the file using a html file input.

Here is a helpful tutorial on how to do this with PHP

http://www.w3schools.com/PHP/php_file_upload.asp

It Might also be helpful to read the manual about uploading a file here $_FILES
Post Reply