| | |
Cant upload mp3's with this script?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Nov 2008
Posts: 20
Reputation:
Solved Threads: 0
Hi,
This script works great when uploading photos but if I try mp3's I get 'Error uploading file'
Any ideas would be much appreciated!
Thanks
This script works great when uploading photos but if I try mp3's I get 'Error uploading file'
Any ideas would be much appreciated!
Thanks
PHP Syntax (Toggle Plain Text)
<? $uploadDir = 'mp3/'; include ("../includes/database.connect.php"); if(isset($_POST['send'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; // get the file extension first $ext = substr(strrchr($fileName, "."), 1); // generate the random file name $randName = md5(rand() * time()); // and now we have the unique file name for the upload file $filePath = $uploadDir . $randName . '.' . $ext; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $query = "INSERT INTO show_archive (file ) ". "VALUES ('$filePath')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); echo "<br>File uploaded<br>"; } ?> <form action="" method="post" enctype="multipart/form-data" name="uploadform"> <table width="350" border="0" cellpadding="1" cellspacing="1" class="box"> <tr> <td width="246"><input type="hidden"><input name="userfile" type="file" class="box" id="userfile"> </td> </tr> <td align="center" valign="middle" colspan="2"><input class="button" type="submit" name="send" value="Submit Details" tabindex="80" /> <a href="index.php" class="box_link3">Back to List</a></form></td> </table> </form>
![]() |
Similar Threads
- Grab Mp3 Files and Play online (PHP)
- file upload script for music files and video files (PHP)
- Converting using ffmeg mencoder (PHP)
- Viruses/Spam is EVERYWHERE!! HELP!! HJT Log inside PLZZ HELP (Viruses, Spyware and other Nasties)
- YupSearch!!!! I HATE THIS!!!! (Viruses, Spyware and other Nasties)
- MSN,Netzero,and some web sites not letting me have full access. (Viruses, Spyware and other Nasties)
- 35 processes, need to trim the fat (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: problem passing a NULL value to MySQL using a php variable
- Next Thread: PHP Cookies Tutorial
| Thread Tools | Search this Thread |
# 5.2.10 action address apache api array auto autoincrement beginner binary broken cakephp checkbox class classes cms code cron curl database date dehasher destroy display dissertation domain dynamic echo echo$_get[x]changingitintovariable... email error errorlog fatalerror file files folder form forms function functions google href htaccess html if-else image images include insert ip javascript joomla legislation limit link load login mail masterthesis menu mlm multiple mysql mysqlquery oop open paypal pdf persist php popup problem query radio random record recursion remote script search server sessions sms sockets source space sql syntax system table tutorial update upload url validator variable video web youtube





