Jump to content

User upload


Boxerman

Recommended Posts

Hi guys,

 

Just trying to work my head around how i would be able to create 2 uploads;

 

1) Mp3 upload

2) picture upload

 

both i want to work the same;

 

how would i get it so when a user uploads a mp3/picture it stores the filename in the database and there username and date/time uploaded?

 

I'm just a little confused on how i would go about it.

 

Thanks,

 

B-Man

Link to comment
Share on other sites

great its pointing me the right way! thanks pal!

 

heres my html form:

 

<form enctype="multipart/form-data" action="masterupload.php">
username 
<input type="text" name="username" size="35" />
<br />
song title
<input type="text" name="song_title" size="35" />
<br />
About mix
<textarea name="about" rows="4" cols="40"></textarea>
<br />
Choose a file to upload:
<input name="uploadedfile" type="file" />
<br />
<input type="submit" value="submit" />
</form>

 

heres masterupload.php

 

<?PHP
$con = mysql_connect("localhost","","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con); 

if ($_SERVER['REQUEST_METHOD'] == "POST") {
$dir = "/users/mp3/";
$uploadfile = $dir . $_FILES['mp3_file']['name'];
move_uploaded_file($_FILES['mp3_file']['tmp_name'], $uploadfile);
$sql = "INSERT INTO $table (song_name, uploader, approved)
VALUES ($_POST[song_name], $_POST[username], $_POST[approved],$uploadfile)";
mysql_query($sql);
}
?> 

 

its not working, could someone lend a helping hand please?

 

Thanks,

 

B-Man

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.