madspof Posted June 27, 2007 Share Posted June 27, 2007 I have this uplaod script which i have slightly modifed so that the upload path is a variable i.e a username but anyway if i uplaod pictures or text documents they uplaod but if you got to mp3's they do not why is this? This is the script live www.deskfun.co.nr/music/uploadf.php Here is the code: <?php include "../status.php"; $cookie_info = explode("-", $_COOKIE['cookie_info']); $namecookie = $cookie_info[0]; $target = "$namecookie/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } ?> Quote Link to comment Share on other sites More sharing options...
madspof Posted June 27, 2007 Author Share Posted June 27, 2007 i dont liek to do this but please could somne one just shed a bit of light on my problem thank you Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted June 27, 2007 Share Posted June 27, 2007 First of all the code below has very little to do with the actual uploading... nothing really. So it's pretty hard to see if you code holds any problem. But I've created a user wuhtzu and I've successfully uploaded a couple of small .mp3's around 200kb to 500kb in size and they have uploaded just fine as you might be able to see I tried to upload a lager .mp3 file, around 4mb in size and it "succeeded". By "succeeded" I mean that the site/script didn't report any error but when it took me to the "Your files" section the file didn't appear. My guess is that your php configuration can't handle upload of such large files. My own host has upload_max_filesize 2M so my guess is that your host host has some limitations too. And if the upload_max_filesize does not stop the upload the max_execution_time sure do. max_execution_time is set to 30 sec by default and most hosts use that setting... So it has nothing to do with .mp3 files but has to do with the your php config - I guess. Could you post some more of your script and some of the php config values from phpinfo() Quote Link to comment Share on other sites More sharing options...
madspof Posted June 27, 2007 Author Share Posted June 27, 2007 okay well i am my own host as my server is sitting right next to me so how would i extend the upload time ? is it the php.ini file by any chance thnks Quote Link to comment Share on other sites More sharing options...
madspof Posted June 27, 2007 Author Share Posted June 27, 2007 lol am sorry about this but the script at the link i gave u is actuallly this i think it is set to allow 10mb of info tho <?php include "../status.php"; $target = "---'''USERS MUSIC'''---/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; //This is our size condition if ($uploaded_size > 83886080) { echo "Your file is too large.<br>"; $ok=2; } if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } ?> Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted June 27, 2007 Share Posted June 27, 2007 Could you post the upload_max_filesize and max_execution_time? And yes, they are set in the php.ini Quote Link to comment Share on other sites More sharing options...
madspof Posted June 27, 2007 Author Share Posted June 27, 2007 okay i think this is the config file as i cudnt fin it in the windows directroy so i went to the program files section where i found php and php5 but to the best of my knowedge i think i am using php5 so this is the config file i found here it is attached [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted June 27, 2007 Share Posted June 27, 2007 If that is your php.ini file it sets upload_max_filesize to 2M which is why you can't upload files larger than 2mb... but I do not think that's the php.ini file being used since it does not hold all the settings... I can't find max_execution_time for example... Could you run this and somehow show us the output - maybe a link to the script on your server. In case you don't know it shows the server config... phpinfo.php <?php phpinfo(); ?> By the way are you using some kind of package which includes Apache, MySQL and PHP like XAMPP, WAMPP? Quote Link to comment Share on other sites More sharing options...
madspof Posted June 28, 2007 Author Share Posted June 28, 2007 sorry for the long reply i had to get off, sorry the partner was calling anyway this is a picture of the info screen and it says that the php.ini that i sent you. but i have a suspicion that config file is incorrect because be php seems to act funny with some scripts p.s find a picture attached [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted June 28, 2007 Share Posted June 28, 2007 I don't know the exact difference between running PHP as CGI binary and integrated web server module but I can see you run it as CGI. Just to mention it. The picture you attached do not show the value for upload_max_filesize and max_execution_time. Is that all the output you get from running phpinfo() ? And if it is the correct php.ini you gave us the problem is that upload_max_filesize is set to 2M... so change that and restart your server. That should enable you to upload larger files. Quote Link to comment Share on other sites More sharing options...
madspof Posted June 28, 2007 Author Share Posted June 28, 2007 sorry i didnt include the rest of the page but what section does the time upload thing come under Quote Link to comment Share on other sites More sharing options...
madspof Posted June 28, 2007 Author Share Posted June 28, 2007 okay forget what i just said the uplaod max is 2m and the upload time is 30 Quote Link to comment Share on other sites More sharing options...
madspof Posted June 28, 2007 Author Share Posted June 28, 2007 I have sorted the problem i had to adjust the config file upload setting and now it works 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.