Jump to content

[SOLVED] why can't this upload, upload mp3's ?


madspof

Recommended Posts

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.";

}

?>

Link to comment
Share on other sites

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() :)

 

 

Link to comment
Share on other sites

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.";

}

?>

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.