ajaxCRUD.com

» a PHP API to create / read / update / delete from a database table using AJAX

Quick Links:

Quick Examples:



www.allthewebsites.org

File Upload Example


Consider the following table:

	CREATE TABLE tblMyMp3CollectionDemo(
	pkMP3ID INT PRIMARY KEY AUTO_INCREMENT,
	fldFilename VARCHAR(150),
	fldTitle VARCHAR(60),
	fldArtist VARCHAR(60),
	fldGenre VARCHAR(40)
	);


File uploading for this demo has been disabled due to repeated hacking attempts.


fldFilenamefldTitlefldArtistfldGenreAction
Add File test tetsttt Euro Pop
Add File         
eqwqeqw (edit delete) eqwq eqwq Rock
Add File         
Add File       Rock
Add File bcvbcvbcvb bvcbcvbvc cvbcv
Add File test testtt Euro Pop
Add File       Rock
test (edit delete) test 2 test 3 testt 4
Add File ghj ghj ghj
1 (edit delete) 1 1 1
Add File         
Add File         
sdvv (edit delete) sdv vsv vvdv
dfv (edit delete) vdvv dvv dvd
fffggg (edit delete)         
ppc (edit delete) dw f f
fsdòò (edit delete) scs csd Pop

Class Implementation:


#include the class
include ('ajaxCRUD.class.php');

#this one line of code is how you implement the class
$tblDemo = new ajaxCRUD("MP3 File",
     "tblMyMp3CollectionDemo", "pkMP3ID");

$tblDemo->omitPrimaryKey();
$tblDemo->setFileUpload("fldFilename", "uploads/");

$allowable_vals = array("Rock", "Euro Pop", "Trance", "HipHop");
$tblDemo->defineAllowableValues("fldGenre", $allowable_vals);

#actually show to the table
$tblDemo->showTable();

View Example by Itself

Click here to view example outside of the template.

Recent Feedback

"OMG! This is just what I was looking for. Thanks so much. This is amazing!" - Posted by Simone on Friday Jul 11th, 2008 at 4:34pm

"Sorry all -- had to disable uploading due to hacking attempts. Feel free to try out on your own server though!" - Posted by Sean Dempsey on Sunday Sep 14th, 2008 at 7:23pm

"comment2, " - Posted by jonn2 on Sunday Nov 9th, 2008 at 6:21am

Leave a Comment

Your Name      
Your Email   
Comment