Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2009, 12:20 AM
Authorized User
 
Join Date: Jun 2009
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Default Upload PHP file code

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. }
__________________
Thanks & regards
Lokananth
[url "http://www.mioot.com"]Live Chat Software[/url] By miOOt
 
Old July 15th, 2009, 03:23 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi
You can find the image upload code here
http://www.tizag.com/phpT/fileupload.php

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

http://www.google.com/search?hl=en&r...t&aq=f&oq=&aqi=
__________________
surendran
(Anything is Possible)
http://www.suren.info
http://ssuren.spaces.msn.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to upload mp3 file using php abhi.sharma05 PHP How-To 4 November 1st, 2011 11:59 PM
upload a simple .php file scrowler Beginning PHP 3 November 15th, 2004 10:54 PM
File upload problems in PHP 4.3.2 clem_c_rock Pro PHP 2 November 1st, 2004 10:49 AM
PHP file upload qazi_nomi PHP How-To 2 July 11th, 2004 10:43 PM
php file upload reason1000 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 June 7th, 2003 10:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.