468,249 Members | 1,461 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,249 developers. It's quick & easy.

PHP File Upload

I have the following code to handle file uploads. There is a database
called "media". The errors I keep getting will follow the code. The
upload data gets into the database fine; it seems to be storing the
file that causes a problem. Please help!

<?php
$link = mysql_connect ( "localhost", "ninja999_tsql", "MYPASS")
or die("Can't connect to database server");

mysql_select_db ("ninja999_testsql", $link)
or die ("Unable to select database");

$filetempname=$_FILES['file']['tmp_name'];
$filename=$_FILES['file']['name'];
$filetype=$_FILES['file']['type'];

$query = "INSERT INTO `media` VALUES ('','$filename','$filetype')";
$result = mysql_query($query);
$query = "SELECT * FROM `media` WHERE `filename` = '$filename'";
$result = mysql_query($query);
$newname = mysql_result($result,0,"id");
move_uploaded_file( $filetempname, "PLACE/".$newname.".dat");
mysql_close($link);
header( "location: PAGE.PHP" );
?>

Warning: move_uploaded_file(PLACE/8.dat): failed to open stream: No
such file or directory in BLAHBLAH/upload.php on line 17

Warning: move_uploaded_file(): Unable to move '/tmp/phpD4xBiO' to
'mnestuffz/8.dat' in BLAHBLAH/upload.php on line 17

Warning: Cannot modify header information - headers already sent by
(output started at BLAHBLAH/upload.php:17) in BLAHBLAH/upload.php on
line 19

Apr 26 '06 #1
1 1172
Never mind, I fixed it (stuffz/ to /stuffz/) yea

Apr 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Tihon | last post: by
15 posts views Thread by Simon | last post: by
2 posts views Thread by matt | last post: by
7 posts views Thread by pbd22 | last post: by
Jacotheron
6 posts views Thread by Jacotheron | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.