How can I make an upload form, that people can upload and it goes into my godaddy web
12-18-2008, 03:20 AM
|
How can I make an upload form, that people can upload and it goes into my godaddy web
|
Posts: 18
Location: California
|
How can I make an upload form, where people upload a song, after a paypal payment is processed, and when they press the upload button,
The song is uploaded on my godaddy web host account.
As you can see here:
http://www.audiophd.com/payment.php
I am trying to implement step 2.
STEP 2. Once payment is processed, you will receive an e-mail with details on uploading your songs on our server.
Right now I'm doing an ugly method but this is what it looks like
http://www.audiophd.com/song_upload.php
Please do not laugh.
Thank you.
|
|
|
|
12-18-2008, 04:35 AM
|
Re: How can I make an upload form, that people can upload and it goes into my godaddy
|
Posts: 843
Name: Mike
Location: United Kingdom
|
Why not let them upload a song, but not store it unless they have paid? That would make more sense to me.
__________________
My Blog/Site: Please login or register to view this content. Registration is FREE
|
|
|
|
12-18-2008, 05:03 AM
|
Re: How can I make an upload form, that people can upload and it goes into my godaddy
|
Posts: 18
Location: California
|
Yes sir, that is what I'm trying to do. How I can let them upload a song as easy as possible. i wanted to make a form to allow them to do that.
Do you know how to make a form to do that?
|
|
|
|
12-18-2008, 06:42 AM
|
Re: How can I make an upload form, that people can upload and it goes into my godaddy
|
Posts: 203
Name: Andy
Location: N.Ireland
|
Hi there,
You could do it with the following, first thing you'll need to do is setup a new database with the following variables, just paste this text in to your sql query section in PHPmyADMIN...
PHP Code:
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for musicuploads -- ---------------------------- DROP TABLE IF EXISTS `musicuploads`; CREATE TABLE `musicuploads` ( `id` bigint(3) NOT NULL auto_increment, `artistname` varchar(200) NOT NULL default '', `songname` varchar(200) default NULL, `audio` text, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=712 DEFAULT CHARSET=latin1;
-- ---------------------------- -- Records -- ----------------------------
Then you'll need the to create a new file called uploadsong.php or whatever you wish... put this content in it..
PHP Code:
<? // configuration
$rs_dbuser="username"; //your username $rs_dbpass="password"; //your password
////////////////////////// // MySQL SERVER DETAILS // //////////////////////////
$rs_dbname="databasename"; //name of your database $rs_dbhost="localhost"; //address to your db (default is localhost) $rs_dbport="3306"; //3306 is default
$rs_domain="http://www.yourdomain.com/"; //full url without trailing slash
?>
<?php // if we click post if(isset($_POST['add'])) {
$path_big = "/var/yourserverpath/httpdocs/audio"; //your server path to the upload directory you wish to use
$extlimit = "yes"; $limitedext = array(".mp3",".wav",".wma",""); $file_type = $_FILES['vAudio']['type']; $file_name = $_FILES['vAudio']['name']; $file_size = $_FILES['vAudio']['size']; $file_tmp = $_FILES['vAudio']['tmp_name'];
if(!is_uploaded_file($file_tmp)){
} $ext = strrchr($file_name,'.'); $ext = strtolower($ext); if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { echo "Wrong file extension. <br>--<a href=\"$_SERVER[PHP_SELF]\">back</a>"; exit(); } $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1];
$rand_name = md5(time()); $rand_name= rand(0,999999999);
move_uploaded_file ($file_tmp, "$path_big/$rand_name.$file_ext");
$conn = mysql_connect($rs_dbhost, $rs_dbuser, $rs_dbpass) or die ('Error connecting to mysql'); @mysql_select_db($rs_dbname) or die ('Can\'t find database'); // then get data from the form $artistname = $_POST['artistname']; $songname = $_POST['songname']; $audio = $_POST['vAudio'];
// replace all ' with \' so mysql doesn't puke $bad = array("'","%"); $good = array("´","%");
// insert it into the db
$query = "INSERT INTO musicuploads (artistname, songname, audio) VALUES ('$artistname','$songname','$rand_name.$file_ext')"; mysql_query($query) or die(mysql_error());
mysql_close($conn);
echo " Your song was added to the database... "; } else { ?>
Add Song
<BR><BR>
<form enctype="multipart/form-data" method="post" />
Song Name: <input name="songname" type="text" id="songname" size="30" maxlength="100" /><BR> <BR><BR> Artist Name: <input name="artistname" type="text" id="artistname" size="30" maxlength="100" /><BR>
<BR><BR>
Select File <input type="file" name="vAudio" id="file" />
<BR><BR> Upload file<BR><BR> Ensure all information entered is correct then, <input type="submit" name="add" id="add" value="Submit" /> </form> <?php } ?>
Obviously you can add your own styling to this, but it'll do the job nicely
If you can't get it working, give me a shout and I'll troubleshoot for you.
Andy
|
|
|
|
12-19-2008, 02:55 AM
|
Re: How can I make an upload form, that people can upload and it goes into my godaddy
|
Posts: 18
Location: California
|
Hey brother Andy why are you such a genuine and nice guy? We need more people like you. I also want to thank the person who contacted me Chris, Thanks Chris for the uploadthingy.com help. I checked out the site, and I don't mean to be a cheap guy but the economy is so bad, $9.00 is a lot of money. So I wanted to take an easy way out.
|
|
|
|
12-19-2008, 04:33 AM
|
Re: How can I make an upload form, that people can upload and it goes into my godaddy
|
Posts: 18
Location: California
|
Hi bro I'm not sure if I'm doing this right. But here are my steps.
I named the pictures according to their steps. So 1.jpg is step one, 2.jpg is step two and so on.
First step I went into my phpadmin and typed songuploader and pressed create.
My second step I click the SQL tab and copy and pasted the code you provided and clicked GO.
My third step it said it successfully executed.
My fourth step I created an upload.php and copy and pasted the code you gave me, and I changed the part where it said:
$rs_domain="http://www.audiophd.com"; //full url without trailing slash
$path_big = "C:/wamp/www/audiophd/uploader"; //your server path to the upload directory you wish to use
$limitedext = array(".mp3",".wav",".aiff","");
These are the changes I made, left everything as is.
Then I entered song and artist name, and browsed for an mp3, and after pressing upload this is what I receive.
Thanks bro for helping.
|
|
|
|
12-19-2008, 06:02 AM
|
Re: How can I make an upload form, that people can upload and it goes into my godaddy
|
Posts: 203
Name: Andy
Location: N.Ireland
|
Hi there,
You musn't have entered your database settings correctly, ensure that your database is located at localhost
You need to update all the information in red below...
PHP Code:
$rs_dbuser="username"; //your username $rs_dbpass="password"; //your password
////////////////////////// // MySQL SERVER DETAILS // //////////////////////////
$rs_dbname="databasename"; //name of your database $rs_dbhost="localhost"; //address to your db (default is localhost) $rs_dbport="3306"; //3306 is default
Thanks,
Andy
|
|
|
|
12-19-2008, 06:52 PM
|
Re: How can I make an upload form, that people can upload and it goes into my godaddy
|
Posts: 18
Location: California
|
Big Andy,
If I didn't apply a password before I installed wamp, do I just make it
$rs_dbpass=""; //your password
?
|
|
|
|
01-15-2009, 12:16 AM
|
Re: How can I make an upload form, that people can upload and it goes into my godaddy
|
Posts: 18
Location: California
|
Can anyone help me out with this one. i'm still trying to figure this out. Thank you so much.
|
|
|
|
01-15-2009, 12:39 AM
|
Re: How can I make an upload form, that people can upload and it goes into my godaddy
|
Posts: 18
Location: California
|
I see there are different services where you have to pay to have their upload form for u, for a monthly fee, but I feel as though it is very unnecessary, wouldn't you agree?
|
|
|
|
|
« Reply to How can I make an upload form, that people can upload and it goes into my godaddy web
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|