I'm running Wordpress 2.8
I would like a script that lets the customer upload a file (jpg,png,gif,etc) pretty much an image file.
Then I would like that file to
(a) be uploaded to my server
(b) a copy sent via e-mail to me
any help?? I know there are some geniuses out there!
Need help with an upload PHP code
Moderator: General Moderators
-
groogruxking40
- Forum Newbie
- Posts: 17
- Joined: Wed Jun 17, 2009 8:04 am
Re: Need help with an upload PHP code
Code: Select all
//GET IMAGE INFO
$dir = 'images/';
$file_name = $_FILES['file']['name'];
$file_tmp = $_FILES['file']['tmp_name'];
//CHECK FOR UPLOADED FILE
if(is_uploaded_file($file_tmp)){
//MOVE TO DIR
move_uploaded_file($file_tmp, $dir.$file_name);
}
-
groogruxking40
- Forum Newbie
- Posts: 17
- Joined: Wed Jun 17, 2009 8:04 am
Re: Need help with an upload PHP code
Thank you so much!!
haven't tried it yet,but I will
now do I just attached a mailto command at the end for it to shoot to my e-mail or what?
Thanks again
haven't tried it yet,but I will
now do I just attached a mailto command at the end for it to shoot to my e-mail or what?
Thanks again
Re: Need help with an upload PHP code
You can send yourself an HTML mail that includes an <img> tag whose src attribute points to a PHP script that returns the image. Or you can embed the image in the email with base-64 encoding. The first method reduces the size of your emails. Look around on this forum for some examples of both of these methods.
Use the mail() function to actually send the email.
PHP Manual: mail
Edit: This post was recovered from search engine cache.
Use the mail() function to actually send the email.
PHP Manual: mail
Edit: This post was recovered from search engine cache.
Last edited by McInfo on Tue Jun 15, 2010 11:25 pm, edited 1 time in total.
-
groogruxking40
- Forum Newbie
- Posts: 17
- Joined: Wed Jun 17, 2009 8:04 am
Re: Need help with an upload PHP code
Ok I got all of that, now do I just upload the .php to my server? or do I actually copy/paste the code on the page I want the form/image upload?
Re: Need help with an upload PHP code
What ".php" are you referring to? Can you elaborate on what you mean by "copy/paste the code on the page I want the form/image upload"?
Edit: This post was recovered from search engine cache.
Edit: This post was recovered from search engine cache.