lewis987 Posted August 21, 2006 Share Posted August 21, 2006 ive got an upload script and it doesnt want to upload a file over a certain size, although the file size and file type is within the regualtions,code:<?php// thanks page after succesfull upload.$tpage = "thanks.htm"; // error page if size exceeded from allowed size.$size= "size.htm"; // error page if extension is not correct.$extpage = "extpage.htm"; // error page if file already exists on server.$exist = "exist.htm"; // error page if no file has been selected.$notselect = "notselect.htm"; // write yes if you want to limit file extensions to be uploaded // And write no if you donot want to limit the files to be uploaded.$elimit = "no";// Write file types which u want to allow.$lext = array(".gif",".jpg",".zip",".iso",".7z",".rar");// check if file has been selected otherwise forwad to erro2.htm$file_tmp = $_FILES['file']['tmp_name'];if (!is_uploaded_file($file_tmp)){ echo header("Location: $notselect"); exit(); } //write the maximum size of file in bytes.if (($_FILES["file"]["size"] <= 10000000000000000)) {//check for file extension if file extension is not correct forwad to extpage.htm $ext = strrchr($file_name,'.'); if (($elimit == "yes") && (!in_array(strtolower($ext),$lext))) { echo header("Location: $extpage"); exit(); }// following string holds file name. $fname = $_FILES['file']['name'];// following string replaces spaces in file name with underscore(_)$fname = str_replace(' ', '_', $fname); //Now if every thing is OK following function will upload the file. // change uploads with your directory in which u want to store the files if (file_exists("uploads/" . $_FILES["file"]["name"])) { echo header("Location: $exist"); } else { move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" ."$fname" ); // Thanks page if file uploaded successfully header("Location: $tpage"); }} else// error page if file size exceded from allowed file size. header("Location: $size");?> any help will be apperciated--lewis Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/ Share on other sites More sharing options...
ToonMariner Posted August 21, 2006 Share Posted August 21, 2006 make sure that the file you are trying to upload is not bigger than the max file size allowed in the php.ini file (default is 8M i believe)If it is then you either have to change the setting or use ftp protocols. Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/#findComment-77985 Share on other sites More sharing options...
lewis987 Posted August 21, 2006 Author Share Posted August 21, 2006 toonMariner ive changed the upload size in the pphp.ini file, but still i cant seem to upload any file bigger 150K and the default ion the php.ini file for uploads is 2M btw, if you can, please help, im very new to php Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/#findComment-77989 Share on other sites More sharing options...
ToonMariner Posted August 21, 2006 Share Posted August 21, 2006 what message does your script put out?does it say successful but no file is there or does it say file is too big? Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/#findComment-77992 Share on other sites More sharing options...
lewis987 Posted August 21, 2006 Author Share Posted August 21, 2006 it says that there was no file selected, try it if you want, http://82.413.137.80it just doesnt want to work, it will upload a file at 1 mb, but not a file 20mbits an apache server btw on windows Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/#findComment-77993 Share on other sites More sharing options...
ToonMariner Posted August 21, 2006 Share Posted August 21, 2006 You said it won't upload a 150k file? then you say it will upload a 1M file but not a 20M file?If that is true you have answered your own question!!!!! Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/#findComment-77994 Share on other sites More sharing options...
lewis987 Posted August 21, 2006 Author Share Posted August 21, 2006 lol, oops, i found out the file i uploaded was 1 mb, not 150k and im needing the script to upload files as large as 2GB and i cant seem to work it out why its not wanting to upload nothing bigger the 1mb, ive even tried a 5mb and the same output Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/#findComment-77996 Share on other sites More sharing options...
ToonMariner Posted August 21, 2006 Share Posted August 21, 2006 you are limited on the size of files you can upload via this method.Have a look for a script to upload large files on google Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/#findComment-78019 Share on other sites More sharing options...
lewis987 Posted August 21, 2006 Author Share Posted August 21, 2006 ok, i havent came accross a free one, have any suggestions? Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/#findComment-78036 Share on other sites More sharing options...
steinmag Posted August 21, 2006 Share Posted August 21, 2006 You might want to check out this page: [url=http://www.radinks.com/upload/config.php]http://www.radinks.com/upload/config.php[/url] Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/#findComment-78052 Share on other sites More sharing options...
lewis987 Posted August 21, 2006 Author Share Posted August 21, 2006 thnaks, but what if i try upload a file with a dash (-) in its name, would it upload? Link to comment https://forums.phpfreaks.com/topic/18182-solved-help-with-upload-script/#findComment-78061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.