Go Back   Novahq.net Forum > Computers > Web design and Programming

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-02-2004, 06:46 PM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
file to mysql db

How do i go about putting a file (from a submitted form, actually 2 files) into a database as a LONGBLOB... doesnt seem to be working for me the way im doing it so i have no clue... any help would be appreciated
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
  #2  
Old 12-02-2004, 06:56 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

lol how do u put a file period (from a submitted form) into a database, any one who answers this questions really wins i need to know!
Reply With Quote
  #3  
Old 12-02-2004, 06:57 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

answers bebobs first tho ... his thread sry m8 i realized after i had posted in your thread...
Reply With Quote
  #4  
Old 12-02-2004, 08:02 PM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
lol thanks its ok tho... i think if no one answers me im gonna go picking through XMB's code to figure out how they did it lol... then *attempt* to do something similar
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
  #5  
Old 12-02-2004, 08:09 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,920

in your mysql query direct from $_POST use:,

Code:
mysql_query("INSERT INTO blah VALUES(NULL,LOAD_FILE('$_FILES['file']['tmp_name']'),'$value2')");
If you uploaded the file first, do a:
Code:
move_uploaded_file(soruce,destination.filename);
then
Code:
chmod(destination.filename,octdec("0777"));
then
Code:
mysql_query("INSERT INTO blah VALUES(NULL,LOAD_FILE('destination.filename'),'$value2')");
then
Code:
chmod(destination.filename,octdec("0644"));
To make it normal again.. As far as I know only 1 file per BLOB.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #6  
Old 12-02-2004, 08:39 PM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
ty panther i wuv u

yeah i know only one file per blob, i have 2 blobs... guess i worded that wrong
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
  #7  
Old 12-02-2004, 08:45 PM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
blah... not workin

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/gamnet/www/scripts/mapdb.php on line 160

Query:
$sql = "INSERT INTO mapdb_maps VALUES ('$cid', 'null', '$name', '$author', '$description', LOAD_FILE('$_FILES['file']['tmp_name']'), LOAD_FILE('$_FILES['screen']['tmp_name']'), '$added', '0')";
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
  #8  
Old 12-02-2004, 10:15 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,920

Quote:
Originally posted by BeBop
blah... not workin

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/gamnet/www/scripts/mapdb.php on line 160

Query:
$sql = "INSERT INTO mapdb_maps VALUES ('$cid', 'null', '$name', '$author', '$description', LOAD_FILE('$_FILES['file']['tmp_name']'), LOAD_FILE('$_FILES['screen']['tmp_name']'), '$added', '0')";
Sorry, rusty on php.

It's becase of the (' and then the 's in the $_FILES['. Type it like this:

$loadfile=$_FILES['file']['tmp_name'];
LOAD_FILE('$loadfile') or even LOAD_FILE('$_FILES["file"]["tmp_name"]')
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #9  
Old 12-02-2004, 10:55 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

one smart man panther lol ... time to make a file database! lol
Reply With Quote
  #10  
Old 12-03-2004, 05:29 AM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
Couldnt add map to DBCan't get stat of '' (Errcode: 2)



this is the chunk of code

$added = date("Y-m-d");
$file = $_FILES['file']['tmp_name'];
$screen = $_FILES['screen']['tmp_name'];
$sql = "INSERT INTO mapdb_maps VALUES ('$cid', 'null', '$name', '$author', '$description',
LOAD_FILE('$file'), LOAD_FILE('$screen'), '$added', '0')";
mysql_query($sql) or die("Couldnt add map to DB".mysql_error());
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
  #11  
Old 12-07-2004, 09:43 AM
BOne is offline BOne
Registered User

Join Date: Aug 2003
Posts: 1,640

Send a message via ICQ to BOne Send a message via Yahoo to BOne
panther seems on point...our humble leader lol
__________________
=====Retired sig team member=====
Reply With Quote
  #12  
Old 12-07-2004, 12:05 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,920

bebop, try moving the file to a specific location on the server using my example #2. And then remove the file after your done. Make sure you include the full path in there.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #13  
Old 12-07-2004, 03:41 PM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
will get on it and let you know, thanks for th econtoniued help
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
  #14  
Old 12-08-2004, 10:31 AM
zabb is offline zabb
Registered User

Join Date: Aug 2004
Posts: 11

Send a message via ICQ to zabb Send a message via AIM to zabb Send a message via Yahoo to zabb
lol I thought i had a clue about MySql.
youre a bad mofo panther, and thanks for the scripts on your homesite. really makes hosting sigs very easy. and the shoutbox works great.
__________________
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
incorporate php file upload with MySQL form? pauldridge Tech Support 1 06-16-2010 08:46 AM
Importing text file in MySQL devildog00001 phphq.Net Forums 1 04-04-2005 08:22 AM
Importing text file in MySQL DevilDog#1 Web design and Programming 11 03-27-2005 10:27 AM
Need some help with db's AoS.Tecoma2 phphq.Net Forums 9 11-01-2004 11:36 AM
db staffy bull Sigs and Graphics 3 09-11-2003 12:33 PM


All times are GMT -5. The time now is 05:22 AM.




Powered by vBulletin®