---
title: "PHP upload MP3"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/156073-php-upload-mp3"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "nummersju"
published: "2007-01-17T18:12:17.000Z"
updated: "2007-01-20T07:56:17.000Z"
replies: 1
views: 472
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/156073-php-upload-mp3"
---

# PHP upload MP3

## #1 — nummersju, 2007-01-17T18:12Z

Hej hej wF'are!
Jag har ett problem med ett uppladdningsscript.
Jag har provat med att ladda upp filer som jpg, waw och txt. Men jag kan inte ladda upp mp3-filer. Det händer ingenting med uppladdningen då...

Vad kan felet vara? Bifogar lite kod.

```php
<?php
<?php
if(isset($_FILES['userfile']))
{

$upload_dir = 'uppladdat/';
$maxsize = (1024*10);
$password = 'abc';

if (isset($_POST['password'])  && $_POST['password'] != $password) {
	echo "Du har ingen åtkomst. Ledsen kisen :(\n";
}

elseif (empty($_FILES['userfile']['name'])) {
	echo "Du kan inte ladda upp luft heller.\n";
}

elseif ($_FILES['userfile']['size'] > $maxsize) {
	echo "The file is to big. \n";
}

else {

move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_dir.$_FILES['userfile']['name' ]);
echo "Filen har laddats upp :)";

}
}else{}

echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" enctype=\"multipart/form-data\"/>\n";
echo "<input type=\"file\" name=\"userfile\"/><br/>\n";
echo "<input type=\"submit\" value=\"Upload file\"/ class=\"button\">\n";
echo "</form>\n";
?>
```

Permalänk: https://www.webforum.nu/p/156073

## #2 — stevenet, 2007-01-20T07:56Z

Jag förmodar att du ökat max i ditt skript när du testat det?

<http://se.php.net/manual/en/features.file-upload.common-pitfalls.php>

*"The MAX_FILE_SIZE item cannot specify a file size greater than the file size that has been set in the upload_max_filesize ini-setting. The default is 2 Megabytes. 

If a memory limit is enabled, a larger memory_limit may be needed. Make sure you set memory_limit large enough. 

If max_execution_time is set too small, script execution may be exceeded by the value. Make sure you set max_execution_time large enough. "*

Du kan, om ditt webbhotell tillåter det, ändra dessa värden med ini_set.

Exempel:

```php
<?php
// Ändra maxuppladdning-filstorleken till 5 Megabyte
ini_set("upload_max_filesize","5M");

?>
```

Permalänk: https://www.webforum.nu/p/1925118

---

Tråden på webben: https://www.webforum.nu/amne/php/156073-php-upload-mp3
