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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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!!!!! Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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] Quote Link to comment 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? Quote Link to comment 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.