|
|
|
|
![]() ![]() |
May 12 2005, 12:59 AM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 436 Joined: 21-January 05 From: Koronadal City, Philippines Member No.: 3,358 |
Can anyone help me out again? Thanks.
I need a code that has a basic form that allows you to browse for an image file and when the submit button is clicked, that image gets uploaded to a folder in my site (e.g. images/*.jpg) |
|
|
|
May 12 2005, 07:44 AM
Post
#2
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 372 Joined: 16-August 04 From: Spain Member No.: 824 |
I was looking for the same functionality. If someone knows how can i code to upload files after browsing and also give the functionality to upload zip files und unzip them once they are uploaded. I would be really grateful!!!!
|
|
|
|
May 12 2005, 09:49 AM
Post
#3
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 362 Joined: 2-March 05 From: The Netherlands Member No.: 4,097 |
also here, GOOGLE is your friend...
Search term: image upload php code http://codewalkers.com/seecode/85.html http://php.resourceindex.com/Complete_Scri...ile_Management/ http://www.fuzzywebmaster.com/results/php-...ipt-upload.html http://www.stadtaus.com/en/php_scripts/gallery_script/ |
|
|
|
May 17 2005, 07:10 PM
Post
#4
|
|
|
Newbie [Level 2] ![]() ![]() Group: Members Posts: 33 Joined: 19-February 05 From: SLOVENIA Member No.: 3,855 |
yes google is still useful
|
|
|
|
May 17 2005, 11:05 PM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 436 Joined: 21-January 05 From: Koronadal City, Philippines Member No.: 3,358 |
Great. I'm toying with the code alrady. Thanks!
|
|
|
|
May 21 2005, 09:17 AM
Post
#6
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 310 Joined: 9-February 05 From: Italian Member No.: 3,677 |
Oh
i think you can use php script on your cpanel or search in hotscripts.com or many php scripts web site but i find to u one uploader CMS i think find it in scriptsbalabala.com its very old CODE <? $extlimit = "yes"; //Do you want to limit the extensions of files uploaded $limitedext = array(".gif",".jpg",".png",".jpeg"); //Extensions you want files uploaded limited to. $sizelimit = "no"; //Do you want a size limit, yes or no? $sizebytes = "200000"; //size limit in bytes $dl = "http://www.zachwhite.com/demo/up-down"; //url where files are uploaded $absolute_path = "/home/zachwhit/public_html/demo/up-down"; //Absolute path to where files are uploaded $websiteurl = "http://www.zachwhite.com"; //Url to you website $websitename = "Zach White Network"; switch($action) { default: echo" <html> <head> <title>Upload Or Download</title> </head> <body> <a href=$PHP_SELF?action=upload>Upload File</a> <a href=$PHP_SELF?action=download>Download File</a> <a href=$websiteurl>Return to $websitename</a> <br><br> Powered by <a href=http://www.zachwhite.com/>PHP Uploader Downloader</a> </body> </html>"; break; case "download": echo " <html> <head> <title>File Download</title> </head> <body><a href=$PHP_SELF?action=upload>Upload File</a> <a href=$websiteurl>Return to $websitename</a>"; $list = "<table width=700 border=1 bordercolor=#000000 style=\"border-collapse: collapse\">"; $list .= "<tr><td width=700><center><b>Click To Download</b></center></td></tr>"; $dir = opendir($absolute_path); while($file = readdir($dir)) { if (($file != "..") and ($file != ".")) { //Download files with spaces fix by Kokesh $list .= "<tr><td width=700><a href='$dl/$file'>$file</a></center></td></tr>"; } } $list .= "</table>"; echo $list; echo" <br><br> Powered by <a href=http://www.zachwhite.com/>PHP Uploader Downloader</a> </body> </html>"; break; case "upload": echo" <html> <head> <title>File Upload</title> </head> <body> <form method=POST action=$PHP_SELF?action=doupload enctype=multipart/form-data> <p>File to upload:<br> <input type=file name=file size=30> <p><button name=submit type=submit> Upload </button> </form> <br><br> Powered by <a href=http://www.zachwhite.com/>PHP Uploader Downloader</a> </body> </html>"; break; //File Upload case "doupload": $dir = "dir"; if ($file != "") { if (file_exists("$absolute_path/$file_name")) { die("File already exists"); } if (($sizelimit == "yes") && ($file_size > $sizebytes)) { die("File is to big. It must be $sizebytes bytes or less."); } $ext = strrchr($file_name,'.'); if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { die("The file you are uploading doesn't have the correct extension."); } @copy($file, "$absolute_path/$file_name") or die("The file you are trying to upload couldn't be copied to the server"); } else { die("Must select file to upload"); } echo " <html> <head> <title>File Uploaded</title> </head> <body>"; echo $file_name." was uploaded"; echo "<br> <a href=$PHP_SELF?action=upload>Upload Another File</a> <a href=$PHP_SELF?action=download> Download File</a> <a href=$websiteurl> Return to $websitename</a><br><br> Powered by <a href=http://www.zachwhite.com/>PHP Uploader Downloader</a> </body> </html>"; break; } ?> Save this code on one php file and save name is updown change your folder permission to 777 If you want to upload or download your file form your folder on your host |
|
|
|
Jun 8 2008, 02:40 PM
Post
#7
|
|
|
Newbie [Level 3] ![]() ![]() ![]() Group: Members Posts: 49 Joined: 28-May 08 Member No.: 62,777 |
Oh i think you can use php script on your cpanel or search in hotscripts.com or many php scripts web site but i find to u one uploader CMS i think find it in scriptsbalabala.com its very old CODE <? $extlimit = "yes"; //Do you want to limit the extensions of files uploaded $limitedext = array(".gif",".jpg",".png",".jpeg"); //Extensions you want files uploaded limited to. $sizelimit = "no"; //Do you want a size limit, yes or no? $sizebytes = "200000"; //size limit in bytes $dl = "http://www.zachwhite.com/demo/up-down"; //url where files are uploaded $absolute_path = "/home/zachwhit/public_html/demo/up-down"; //Absolute path to where files are uploaded $websiteurl = "http://www.zachwhite.com"; //Url to you website $websitename = "Zach White Network"; switch($action) { default: echo" <html> <head> <title>Upload Or Download</title> </head> <body> <a href=$PHP_SELF?action=upload>Upload File</a> <a href=$PHP_SELF?action=download>Download File</a> <a href=$websiteurl>Return to $websitename</a> <br><br> Powered by <a href=http://www.zachwhite.com/>PHP Uploader Downloader</a> </body> </html>"; break; case "download": echo " <html> <head> <title>File Download</title> </head> <body><a href=$PHP_SELF?action=upload>Upload File</a> <a href=$websiteurl>Return to $websitename</a>"; $list = "<table width=700 border=1 bordercolor=#000000 style=\"border-collapse: collapse\">"; $list .= "<tr><td width=700><center><b>Click To Download</b></center></td></tr>"; $dir = opendir($absolute_path); while($file = readdir($dir)) { if (($file != "..") and ($file != ".")) { //Download files with spaces fix by Kokesh $list .= "<tr><td width=700><a href='$dl/$file'>$file</a></center></td></tr>"; } } $list .= "</table>"; echo $list; echo" <br><br> Powered by <a href=http://www.zachwhite.com/>PHP Uploader Downloader</a> </body> </html>"; break; case "upload": echo" <html> <head> <title>File Upload</title> </head> <body> <form method=POST action=$PHP_SELF?action=doupload enctype=multipart/form-data> <p>File to upload:<br> <input type=file name=file size=30> <p><button name=submit type=submit> Upload </button> </form> <br><br> Powered by <a href=http://www.zachwhite.com/>PHP Uploader Downloader</a> </body> </html>"; break; //File Upload case "doupload": $dir = "dir"; if ($file != "") { if (file_exists("$absolute_path/$file_name")) { die("File already exists"); } if (($sizelimit == "yes") && ($file_size > $sizebytes)) { die("File is to big. It must be $sizebytes bytes or less."); } $ext = strrchr($file_name,'.'); if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { die("The file you are uploading doesn't have the correct extension."); } @copy($file, "$absolute_path/$file_name") or die("The file you are trying to upload couldn't be copied to the server"); } else { die("Must select file to upload"); } echo " <html> <head> <title>File Uploaded</title> </head> <body>"; echo $file_name." was uploaded"; echo "<br> <a href=$PHP_SELF?action=upload>Upload Another File</a> <a href=$PHP_SELF?action=download> Download File</a> <a href=$websiteurl> Return to $websitename</a><br><br> Powered by <a href=http://www.zachwhite.com/>PHP Uploader Downloader</a> </body> </html>"; break; } ?> Save this code on one php file and save name is updown change your folder permission to 777 If you want to upload or download your file form your folder on your host google is very very useful |
|
|
|
![]() ![]() |
Similar Topics