Reply to topic
Upload PHP file code
gilbertsavier


Joined: 25 Jun 2009
Posts: 9
Reply with quote
Hi,
I need a code that lets my customers upload a image file from their computer and then that file does 2 things

1. gets uploaded to upload folder on my server
2. a copy of that file gets e-mailed to me

this is what I have so far, any improvements/additions on this code would really be appreciated...

1.//GET IMAGE INFO
2.
3. $dir = 'images/';
4. $file_name = $_FILES['file']['name'];
5. $file_tmp = $_FILES['file']['tmp_name'];
6.
7. //CHECK FOR UPLOADED FILE
8. if(is_uploaded_file($file_tmp)){
9. //MOVE TO DIR
10. move_uploaded_file($file_tmp, $dir.$file_name);
11. }
rmathus


Joined: 09 Mar 2007
Posts: 44
Location: Baltimore, MD
Reply with quote
Looks good so far. You might want to check out the post at the following URLs which seems to accomplish what you're doing and might give you some ideas:

http://www.codingforums.com/showthread.php?t=85459
http://www.phpmagicbook.com/upload-file-email-file-restrict/
http://www.phpmagicbook.com/upload-file-attach-send-html-format-email/
Upload PHP file code
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic