strange php upload issue with non image files causing 403 submisson error why? - image files ok -
got unusual situation:
my php script correctly uploads image files , renames them long designated, png/gif/jpeg files.
but! when upload non image file eg. .php or .html [ testing / hackers ] first upload rejected expected , own constucted error issued - far happens next if:
1) upload nxt/2nd file, if next file permitted image file no problems. 2) upload next/2nd file , if 2nd file non-permitted image file ie. two-consequetive non-allowed uploads script stops execution right recall of script/url in browser 403 - submision error ???
if browser refresh, same 403 error persists. if click url , press homecoming script runs 'a new' previous field values beingness emptied.( have changed permission on non-image files beingness uploaded 777 enusre not cause - same error persists )
how resolve this??? - problem own code? - or problem html/php internal workings? - else be, body faced similar probs??
thank you.
--- wants code - showing of import bits..
<form name="sellerscript" action="" method="post" enctype="multipart/form-data"> <input type="file" name="upload3" id="f3" size="40" /> <input value="image upload/adjust" name="imgupload" type="submit"> <br> <input type="hidden" name="turn" value="<?php echo $round;?>" /> <input name="fn3h" type="hidden" value="<?php echo $fn3; ?>" /> <input name="uf3h" type="hidden" value="<?php echo $uf3; ?>" />
--- php --
//================ upload files vars =[ foto/image 3 used ===========
$allowed = array( 'image/gif' , 'image/png' , 'image/jpeg' , 'image/pjpeg' ); $fname=$fname2=$fname3=''; $uploaded1=$uploaded2=$uploaded3=$auto_insertid=false;
$uid1=$uid2=$uid3=''; // id uploads table $currentf1=$currentf2=$currentf3=''; //-- nowadays loaded fname
//-- upload processing
if ( !isset($_post['rmp3']) && $removep3h!='yes') //not come in whn prev.file.beng remvd {
//-- echo '<br>image 3 beingness uploaded:name+'.$_files['upload3']['name'].'<br>' ;
if ( isset($_files['upload3']) ) {
if ( ( ($_files['upload3']['name']!="" ) || ($_files['upload3']['name']!=null ) ) && ($_files['upload3']['size'] <= 1524288 ) ) { $uf3=$_files['upload3']['name']; // users own name of lastly uploaded file;
//--echo "<br> _________ file under 520k --upload permitted file---------";
///////////////////////////////
above seems working except: when 2 files othher png/gif/jpeg uploaded consequetive 1 after next - 403 error occurs.
files are: [root@myhost desktop]# ls -l *.png -rwxrwxrwx 1 root root 27342 oct 30 18:46 a1-banner5.png -rwxrwxrwx 1 root root 31812 nov 11 23:31 a1-credit.png # -rwxrwxrwx 1 arif arif 1418 oct 8 2011 2851auto.gif -rwxrwxrwx 1 root root 2321 oct 8 2011 btf2.gif
-rwxrwxrwx 1 root root 46321 oct 22 23:35 ez-calc.html
-rwxrwxrwx 1 root root 25958 oct 25 23:58 dixonhome.html -rwxrwxrwx 1 root root 24883 oct 26 00:01 dixons-home.html
note: image files upload in sequences without problems except [a1-banner5.png] - prodouces same issue if uploaded 2nd file next non-image upload ie. 403 error. other hrml files beingness yploaded consequitively produce 403 error.
files uploded from: drwxr-xr-x 26 root www-data 4096 feb 13 20:38 desktop files uploaded to: drwxrwxrw- 2 www-data www-data 4096 feb 17 23:45 uploads temporary directory: drwxrwxrwx 47 root www-data 12288 feb 18 00:25 tmp (tried root grp - same err)
error:url + 403
www.testdomain/domainsite/sellerscript.php
403 forbidden access resource on server denied! powered litespeed web server litespeed technologies not responsible administration , contents of web site!
also when script runs perfect image uploads: url:
wwww.testdomain/domainsite/sellerscript.php
the file > photo-3/btf2.gif has been uploaded!
[ note: both urls same !]
i hope plenty iformation spot problem.
thank you.
well, check permissions, if can search in directory , read/write rights.
php
No comments:
Post a Comment