Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Junior Member
    Join Date
    Nov 2006
    Posts
    6
    Member #
    14438
    Hello,
    I have to make a website for my schools guitar club, and the sponser wants a section that students can upload music they have created to the server. Correct me if I am wrong but it would be easiest to do this in php correct? I am just looking for some pree written code that will allow me to add this feature, and was wondering if you guys might know how to get it set up?
    Thanks Alot

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Hey,

    I posted a tutorial covering uploading MP3 files here a while back: http://www.webdesignforums.net/showthread.php?t=21029

  4. #3
    Junior Member
    Join Date
    Nov 2006
    Posts
    6
    Member #
    14438
    hey thanks for the code,
    when i tried it on my site, (host is tripod) it gave me this error,
    http://kvbutler.tripod.com/%3C?php%20echo%20$PHP_SELF%20?%3E
    any idea where i went wrong, oh and the server we are using isn't tripod but i just wanted to test the code before i turned it in for a grade.
    thanks again.

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    In the code I gave you, in the form tag, in the action property it is
    <?php echo $PHP_SELF: ?>
    Change that to
    <?php echo $_SERVER['PHP_SELF']; ?>
    Also note, you will need a subdirectory called uploads which will need necessary privileges for the script to work.

    Post the code you have if still no joy.

  6. #5
    Junior Member
    Join Date
    Nov 2006
    Posts
    6
    Member #
    14438
    this time i got this,
    http://kvbutler.tripod.com/%3C?php%20echo%20$_SERVER['PHP_SELF'];%20?%3E
    but i think it might be the host... do you know of any hosts that would allow access?

  7. #6
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Im 80% sure that that is saying your form tag is not properly coded.

    Although I am not sure if Tripod has PHP support, and I doubt a host like them would allow uploads,.

  8. #7
    Junior Member
    Join Date
    Nov 2006
    Posts
    6
    Member #
    14438
    this is what im using do u see anything wrong with it?
    <html>

    <head>

    <title>Upload MP3</title>

    <?php

    if($_POST['submit']=="Upload") {
    if ($_FILES['file']['name'] != "") {
    if (($_FILES['file']['type'] == "audio/mpeg") || ($_FILES['file']['type'] == "application/force-download")) {
    if ($_FILES["file"]["size"] < 2097152) {
    move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
    echo "File has been stored in your uploads directory.";}
    else { echo "Please upload a file that is under 2 mb!";}
    } else {
    echo "Please upload a mp3 file!";
    exit;}
    } else { echo "Please enter a file.";}
    }
    ?>

    </head>

    <body>

    <p style="font-family: verdana;">Please select a file to upload: </p>

    <br />

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">

    <input type="file" name="file" size="40" />

    <br /><br />

    <input type="submit" name="submit" value="Upload" />

    <br /><br />

    <span style="font-family: verdana; font-size: 12px;">* only mp3 files under 2 megabytes are allowed.</span>

    </form>

    </body>

    </html>

  9. #8
    Senior Member simpleurl's Avatar
    Join Date
    Jul 2006
    Location
    Leicester, UK.
    Posts
    150
    Member #
    13598
    Nothing wrong with your code... Just the host.Doesn't support PHP scripts

  10. #9
    Junior Member
    Join Date
    Nov 2006
    Posts
    6
    Member #
    14438
    is my directory set up right?
    http://dupemethod.org/godfather/
    i had my friend up load it to his site that im pretty sure allows php.
    oh the site is listed under kenny site.

  11. #10
    Senior Member simpleurl's Avatar
    Join Date
    Jul 2006
    Location
    Leicester, UK.
    Posts
    150
    Member #
    13598
    I just get 404'd on trying an upload... is your script embedded in the kenny site.htm? Because if it is you need to change it to kenny site.php


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:27 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com