Drezard Posted September 14, 2006 Share Posted September 14, 2006 Hello, How do i create a script that uploads a file to the webserver. But I only want files smaller then 1mb and Jpgs and Pngs. How do i do this?- cheers, Daniel Link to comment https://forums.phpfreaks.com/topic/20698-file-upload-problem/ Share on other sites More sharing options...
geoffl1 Posted September 14, 2006 Share Posted September 14, 2006 use an html file for the upload form and have it post to a php... you can find tons of them around the internet if you look. Link to comment https://forums.phpfreaks.com/topic/20698-file-upload-problem/#findComment-91557 Share on other sites More sharing options...
laide234 Posted September 14, 2006 Share Posted September 14, 2006 This might be of some help...http://www.nstoia.com/toh/technical/imageresize/index.php Link to comment https://forums.phpfreaks.com/topic/20698-file-upload-problem/#findComment-91601 Share on other sites More sharing options...
HuggieBear Posted September 14, 2006 Share Posted September 14, 2006 There's a tutorial for one here at [url=http://www.phpfreaks.com/tutorials/85/6.php]PHP Freaks[/url].It says it's for beginners, and it looks as though it has lots of advanced features.RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/20698-file-upload-problem/#findComment-91604 Share on other sites More sharing options...
rajeshrhino Posted September 14, 2006 Share Posted September 14, 2006 Your HTML page :-----------------<form name='file_upload' method='POST' action='Upload.php' enctype='multipart/form-data'><input type='file' name='file'><input type='submit' name='Upload' value='Upload'></form>Upload.php-----------<?phpif($_POST['Upload']) { if(isset($_FILES[file][tmp_name]) && $_FILES[file][error]=='0') { if($_FILES[file][type]=='image/pjpeg' || $_FILES[file][type]=='image/x-png') { if($_FILES[file][size]<'1048576') { $src = $_FILES[file][tmp_name]; $des = $_FILES[file][name]; if(!move_uploaded_file($src,$des)) { if(!copy($src,$des)) { echo "Unable To Upload File!"; } } } else { echo "Upload Images less than 1 Mb size only"; } } else { echo "Can Upload only JPG & PNG Images"; } }}?> Link to comment https://forums.phpfreaks.com/topic/20698-file-upload-problem/#findComment-91608 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.