| | |
Uploading files to mysql
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
hi,
I am trying to learn how to upload multiple Music files to server then save information about them in database e.g. albumname, filename, type and maybe url. i have few questions:
1. would i be able to write the albumname in database as the folder i am uploading to. if so how?
2. how would i upload multiple files..
as i am a newbie can you guys please show me an example of this...
thanks
I am trying to learn how to upload multiple Music files to server then save information about them in database e.g. albumname, filename, type and maybe url. i have few questions:
1. would i be able to write the albumname in database as the folder i am uploading to. if so how?
2. how would i upload multiple files..
as i am a newbie can you guys please show me an example of this...
thanks
1. Yes. Since you know where you will be uploading the file, you can save the foldername as albumname
2. By using multiple
I am not sure if the examples in these links work, but, this is how you do it.
http://www.phpeasystep.com/workshopview.php?id=2
http://www.plus2net.com/php_tutorial...ile_upload.php
2. By using multiple
<input type='file' > tagI am not sure if the examples in these links work, but, this is how you do it.
http://www.phpeasystep.com/workshopview.php?id=2
http://www.plus2net.com/php_tutorial...ile_upload.php
Last edited by nav33n; Feb 26th, 2009 at 8:49 am.
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Jan 2009
Posts: 60
Reputation:
Solved Threads: 4
It's not as hard as you'd think.
Say that that you're creating a Pastebin. You'd have (simplified) the fields id, title, and filename. The filename could be random. For our purposes, $input is what the user is saving in the document, $title is the title, and we'll create the filename.
Of course, that's just creating it.
Say that that you're creating a Pastebin. You'd have (simplified) the fields id, title, and filename. The filename could be random. For our purposes, $input is what the user is saving in the document, $title is the title, and we'll create the filename.
PHP Syntax (Toggle Plain Text)
<?php $title = mysql_real_escape_string($title); $filename = rand(1,1000) . substr(0, 5, time()); mysql_query("INSERT INTO `pastebin`(title, filename) VALUES('$title', '$filename')"); $fh = fopen($filename . ".txt", +w); fwrite($fh, $input); fclose($fh); ?>
Of course, that's just creating it.
I got the answer to second question basically i will pass the id of textbox to insert.
but how would i actually write the url dynamically upon uploading, to database. say i am uploading into a folder called 'album1' 5 mp3s. now how would i insert in database album1/mp3.mp3, without hardcoding it like $path = "album1";
but how would i actually write the url dynamically upon uploading, to database. say i am uploading into a folder called 'album1' 5 mp3s. now how would i insert in database album1/mp3.mp3, without hardcoding it like $path = "album1";
Last edited by sam1; Feb 26th, 2009 at 11:01 am.
•
•
•
•
but how would i actually write the url dynamically upon uploading, to database. say i am uploading into a folder called 'album1' 5 mp3s. now how would i insert in database album1/mp3.mp3, without hardcoding it like $path = "album1";
Right ? Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
- how to develop a music portal using php mysql? (PHP)
- list selected files on MySQL server (PHP)
- Uploading 2 files at once + script problem (PHP)
- Missing Something in mysql (MySQL)
- Problem in Uploading Files using Register Global on/off (PHP)
- PHP for large files (PHP)
- uploading .txt file via phpmyadmin to Mysql (MySQL)
Other Threads in the PHP Forum
- Previous Thread: Looping through results query!
- Next Thread: Ending Sessions
| Thread Tools | Search this Thread |
ajax apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date decode display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail match md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf php problem protocol query radio random recursion regex remote script search server session sessions sms smtp soap source space sql strip_tags survey syntax system table tutorial undefined update upload url validator variable video virus votedown web window.onbeforeunload=closeme; xml youtube






