| | 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) |
|
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!!!!
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/
Great. I'm toying with the code alrady. Thanks!
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
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
Recent Queries:-
Keywords : upload pics php
I'm in the process of making a photo gallery script. I need ideas on how to make a batch upload I need to add a facility on my customer's website so his clients can send him jobs, typically wappyFTP v1.00 by wappy --- site: http://cult.trap17.com mail: admin@cult.trap17.com --- -Welcome Hi, I'm trying to upload rather large jpgs files (2560x1920 and ~ 2 megs in size) to my server This is what the script does: when a file is uploaded from a form, this script checks what directory upload.php CODE <?php /********************************** * ** file directory list * Looking for upload, pics, php
|
|
![]() Upload Pics With Php? |
| ADD REPLY / Got an Opinion! | a humble request :-) | RAPID SEARCH! | Free Hosting | [X] |
|
Express your Opinions, Thoughts or Contribute your information that might help someone here. Ask your Doubts & Queries to get answers.. "Together, We enlight each other!" |
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP. | 500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE |
|