craigtolputt Posted March 12, 2009 Share Posted March 12, 2009 Hi Guys, I have this script to upload files but im not sure what i would use as the html form to find the files and then send to this script. <?php if (($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "application/pdf") || ($_FILES["file"]["type"] == "application/msword") || ($_FILES["file"]["type"] == "application/powerpoint") || ($_FILES["file"]["type"] == "application/excel") || ($_FILES["file"]["type"] == "text/plain") && ($_FILES["file"]["size"] < 200000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?> Does anyone know the html for an upload form please? Quote Link to comment https://forums.phpfreaks.com/topic/149088-html-form-to-go-with-php-script/ Share on other sites More sharing options...
timmah1 Posted March 12, 2009 Share Posted March 12, 2009 Doing a simple google search returned about 12,100,000 http://www.google.com/search?q=php+upload+file&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a Quote Link to comment https://forums.phpfreaks.com/topic/149088-html-form-to-go-with-php-script/#findComment-782882 Share on other sites More sharing options...
craigtolputt Posted March 12, 2009 Author Share Posted March 12, 2009 yeah i have tried that but most of them dont seem to let me upload .ppt or .pps files and have a size limit on them. i found this on a forum but i dont know what the html form would be like. Quote Link to comment https://forums.phpfreaks.com/topic/149088-html-form-to-go-with-php-script/#findComment-782885 Share on other sites More sharing options...
timmah1 Posted March 12, 2009 Share Posted March 12, 2009 You can define what types of files are allowed to be uploaded, as well as set a fixed size of the download. The max file size is set within you php.ini file Quote Link to comment https://forums.phpfreaks.com/topic/149088-html-form-to-go-with-php-script/#findComment-782892 Share on other sites More sharing options...
craigtolputt Posted March 12, 2009 Author Share Posted March 12, 2009 How would i create a php.ini file so that the max file size is say 5gb Quote Link to comment https://forums.phpfreaks.com/topic/149088-html-form-to-go-with-php-script/#findComment-782893 Share on other sites More sharing options...
Maq Posted March 12, 2009 Share Posted March 12, 2009 Please read this basic tutorial: PHP File Upload. Quote Link to comment https://forums.phpfreaks.com/topic/149088-html-form-to-go-with-php-script/#findComment-782894 Share on other sites More sharing options...
DjMikeS Posted March 12, 2009 Share Posted March 12, 2009 Are you serious on uploading a file of 5GB with php ? That means you would have to set the script execution time to say....10 hours? I really don't think that that's a good idea... Quote Link to comment https://forums.phpfreaks.com/topic/149088-html-form-to-go-with-php-script/#findComment-782907 Share on other sites More sharing options...
craigtolputt Posted March 12, 2009 Author Share Posted March 12, 2009 Well im not too sure on the file size as i dont know what files they will upload. All i know is that they want to upload .ppt or .pps files and they could be quite large. Quote Link to comment https://forums.phpfreaks.com/topic/149088-html-form-to-go-with-php-script/#findComment-782909 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.