PHPBuilder - Best and Easy File Upload Program - file 2



RSS Twitter
Snippets Other

Best and Easy File Upload Program - file 2

by: James Smith
|
September 13, 2001

Version: 2

Type: Full Script

Category: Other

License: GNU General Public License

Description: I have written this program on linux OS , the directory structure will be different for windows OS , you can configure it as u require, but initially follow the commented documentation for installation and configuration in uploadresp.html read the comments carefully before using it



<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="Author" content="Madhu">
   <meta name="GENERATOR" content="Mozilla/4.75 [en] (Win98; U) [Netscape]">
   <title>uploadresp</title>
</head>
<body>
&lt;html>
<br>&lt;body>
<br>&lt;?
<br>&nbsp;# Name this file as uploadresp.php and put it in phpcodes directory
<br>&nbsp;# note upload.php and uploadresp.php must be in same folder
<br>&nbsp;# directory structure
<br>&nbsp;# /home/httpd/html/ideas chmod 777 uploaddirectory
<br>&nbsp;# /home/httpd/html/ideas/giftimages/
<br>&nbsp;# /home/httpd/html/ideas/phpcodes
<br>&nbsp;# If u see a message permission denied for image upload message
<br>&nbsp;# give chmod 777 ideas Directory
<br>&nbsp;# give chmod 777 giftimages Directory
<br>&nbsp;# in myproject directory
<br>&nbsp;# where uploaddirectory is subfolder or child directory
<br>&nbsp;# Original Code to Upload file : Written by James Smith
<br>&nbsp;# Configuration =============================
<br>&nbsp;
<br>&nbsp;$uploaddir = "/home/httpd/html/ideas/giftimages/";
<br>&nbsp;$username = "James Smith";
<br>&nbsp;$email = "james_smith73@yahoo.com";
<br>&nbsp;$mailsubject="Image Uploaded";
<br>&nbsp;$mailsubject2="Image Upload Failed";
<br>&nbsp;$Fromname="James Smith";
<br>&nbsp;$Fromaddress="James Company ";
<p>&nbsp; //Upload&nbsp; 2 Image -------------------------------------
<br>&nbsp;if(!empty($myimage_name))
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(copy($myimage,$uploaddir.$myimage_name))
<br>&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg="Hi James, the $myimage_name
is Uploaded into $uploaddir Directory";
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print ($msg);
<br>&nbsp;&nbsp;&nbsp; if (mail($username." &lt;".$email.">", $mailsubject,
$msg, "From: ".$Fromname." &lt;".$Fromaddress.">\nContent-Type: text/html;
charset=iso-8859-1"))
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print ("Confirmation Mail Sent ");
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print ("Mail Could not be Delivered");
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp; }
<br>&nbsp;&nbsp; else
<br>&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg="Hi James, Something Went
Wrong Image did not Get Uploaded , please use chmod777 to upload directory";
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print ($msg);
<br>&nbsp;&nbsp;&nbsp; if (mail($username." &lt;".$email.">", $mailsubject2,
$msg, "From: ".$Fromname." &lt;".$Fromaddress.">\nContent-Type: text/html;
charset=iso-8859-1"))
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print ("Confirmation Mail Sent ");
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print ("Mail Could not be Delivered");
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp; }
<br>?>
<br>&lt;/body>
<br>&lt;/html>
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
</body>
</html>

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
James Smith

Comment:



Comment:

(Maximum characters: 1200). You have characters left.