hay guyz .....
im tryin to upload a file to my server n im gettin
this on the screen :
file submittedmissing in beta ! ! ! !.txtfile sixe
162file typetext/plain
Warning: Unable to open '' for reading: Permission
denied in e:\final project\zroot\up.php on line 89
Either you did not upload any file, or you uploaded an
empty file! (Y) :P:P:P
toby z
here s the code
lou.php
---------
echo("<form enctype=\"multipart/form-data\"
action=up.php method=post>");
include"writer_info_dsply.php";
include "lang_dsply.php";
include "cat_dsply.php";
// <!-- entr title -->
echo("<tr> <td> title </td>");
echo (" <td> <INPUT NAME=title TYPE=text
style=\"font-family: '$font'\"> </INPUT> </td> </tr>
");
// <!-- summary -->
echo("<tr> <td valign='top'>summary </td>");
echo(" <td> <textarea name=summary rows=7 cols=60
wrap=virtual style=\"font-family: '$font'\">
</textarea> </td> </tr> ");
echo("<tr> <td valign='top'><input type=hidden
name=MAX_FILE_SIZE value=2000000>
Send this file: <input name=userfile type=file> </td>
<td> (file size should not exceed 2mb)</td> </tr>
<tr><td> <input type=submit value='Send File'
style=\"font-family: Riwaj\">
</td></tr>");
-------------------------------------------------------
up.php
--------
// followin waz tried outta sheer despiration
$file_origin = $_POST['file_origin'];
$destination_directory=$_POST['destination_directory'];
$file_destination = $_POST['$file_destination'];
$overwrite = $_POST['$overwrite'];
$fatal = $_POST['$fatal'];
$fp = $_POST['$fp'];
$error_prefix = $_POST['$error_prefix'];
$copy_file = $_POST['$copy_file'];
$copy_file = $_POST['$copy_file'];
$dest_file_exists = $_POST['$dest_file_exists'];
// endda despration 1
include "cpychk.php";
include"cnctdb.php";
include"styl.php";
/* i cut it out ven i found i had been a goof again
.... :(
$userfile_name=$_POST['userfile_name'];
$userfile_size=$_POST['userfile_size'];
$userfile_type=$_POST['userfile_type'];
*/
$userfile_name=$_FILES['userfile']['name'];
$userfile_type=$_FILES['userfile']['type'];
$userfile_size=$_FILES['userfile']['size'];
$cat_opt_name =$_POST['cat_opt_name'];
$lang_opt_name=$_POST['lang_opt_name'];
$firstName=$_POST['firstName'];
$lastName=$_POST['lastName'];
$title=$_POST['title'];
$summary=$_POST['summary'];
echo("file submitted" .$userfile_name );
echo("file sixe " .$userfile_size);
echo("file type" .$userfile_type);
$unique_id = time();
$name = "$unique_id.$userfile_name"; // fo t imestmp
++ usr givn name !!!!!
$zname = 'moronhead'; // sorry bout dis try ....
//if (copy($userfile, "E:/final project/zroot/tmp
uploadz/" . $unique_id."-". $userfile_name )) // dis
didnt work
if (copy($_FILE['userfile']['name'], "E:/final
project/zroot/tmp uploadz\\" . $unique_id)) // so i
tried dis .... :S
{
echo("<b> file successfully uploaded </b>");
// insrtn in2 db !!!!
$query = "SELECT memb_id FROM lgn where login =
'$login' ";
$query_result_handle = mysql_query ($query)
or die ('qry failed ! DA tbl must xixt in DA db
specifyd bov ....');
$memb_id=mysql_fetch_row($query_result_handle);
$sql = "insert into ctnt_inf (cat_id, lang_id,
memb_id, firstName, lastName, title, summary,
path_of_upload, isfile, type,sixe, date_time, day,
month, year ) " .
"values (" . $cat_opt_name . "," . $lang_opt_name .
", " . $memb_id[0] . ",'" . $firstName . "', '" .
$lastName . "','" . $title . "','" . $summary . "','"
. $unique_id. "', '1' ,'" . $userfile_type . "','" .
$userfile_size . "'," . time() . ", " . date("d"). ",
" . date("m"). ", " . date("Y").") ";
if ( mysql_query($sql) )
{ echo("<font face='riwaj'><P>article submitted !
! ! !</P>"
. $title."<br>"//. $body .
. "<br>".$summary.
"</font>" );
}
else
{ echo("<P>Error uploadin file : " .
mysql_error() . "</P>");
}
}
else //(!$userfile_size)
echo( "Either you did not upload any file, or you
uploaded an empty file! ");
echo( "(Y)" .
" " . ":P:P:P"."<br><br>".
$login . "<br>" ) ;
echo($firstName ." ". $lastName);
echo($query);
echo($sql);
-------------------------------------------------------
included file cpychk.php
-------------------------
//function that performs various checks before
copying:
function file_copy($file_origin,
$destination_directory,
$file_destination, $overwrite, $fatal) {
if ($fatal) {
$error_prefix = 'FATAL: File copy of \'' .
$file_origin . '\' to \'' .
$destination_directory . $file_destination . '\'
failed.';
$fp = @fopen($file_origin, "r");
if (!$fp) {
echo $error_prefix . ' Originating file cannot be
read or does not exist.';
exit();
}
$dir_check = @is_writeable($destination_directory);
if (!$dir_check) {
echo $error_prefix . ' Destination directory is not
writeable or does not exist.';
exit();
}
$dest_file_exists =
file_exists($destination_directory .
$file_destination);
if ($dest_file_exists) {
if ($overwrite) {
$fp = @is_writeable($destination_directory .
$file_destination);
if (!$fp) {
echo $error_prefix . ' Destination file is not
writeable [OVERWRITE].';
exit();
}
$copy_file = @copy($file_origin,
$destination_directory . $file_destination);
}
} else {
$copy_file = @copy($file_origin,
$destination_directory . $file_destination);
}
} else {
$copy_file = @copy($file_origin,
$destination_directory . $file_destination);
}
}
-----------------------------------------------------
ok now
1 . i came across this cpychk thinggy couple of months
bak n im sorry i cant remember vere i found it ....
:$:$:$
2. i cant even get to display my qureyes on the up.php
screen .....
3. its pickin up the file name, type n size all fine
but y the hell cant it open the file fo readin ????? i
fail to under stand
4. the phpinfo.php at my web host says :
upload_tmp_dir (local)no value (master)no value
what shall i do with that ?????
5. im sure ive must ve made an idiot outta myslf
asusual but plz pardon me fo it all n
sos plz .......
thnx a billion guys fo lumpin me .....
clueless as usual .....
toby ......
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php