uploader not working

Started on the old forum in April 2009 · view the original in the archive · old links redirect here

29 replies · 1,134 views · started 17 years ago · 1 min read

6 participants
godzilla Developer · 119 posts #1

i m not able to upload files.

i got error like

Warning: move_uploaded_file(/photo.jpeg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/xyz/public_html/mysite/upload.php on line 270

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpRaMEQw' to '/photo.jpeg' in /home/xyz/public_html/mysite/upload.php on line 270 Couldn't copy file.

help me plz

this is upload.php

<?php
include("config.php");
include("core.php");
header("Cache-Control: no-cache, must-revalidate");	        // Prevent caching, HTTP/1.1
header("Pragma: no-cache");
//header('Content-type: application/vnd.wap.xhtml+xml'); 
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$bcon = connectdb();
if (!$bcon)
{
    echo "<head>";
    echo "<title>Error!!!</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/default_medium.css\">";
    echo "</head>";
    echo "<body>";
    echo "<p align=\"center\">";
    echo "<img src=\"../images/notok.gif\" alt=\"!\"/><br/>";
    echo "<b><strong>Error! Cannot Connect To Database...</strong></b><br/><br/>";
    echo "This error happens usually when backing up the database, please be patient...";
    echo "</p>";
    echo "</body>";
    echo "</html>";
    exit();
}

$brws = explode(" ",$_SERVER[HTTP_USER_AGENT] );
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$type1 = $_GET["type"];
$uid = getuid_sid($sid);
$desc = $_POST['desc'];
$upload = $_POST['upload'];
$superdat = $_FILES['superdat']['tmp_name'];
$superdat_name=$_FILES['superdat']['name'];
$superdat_size=$_FILES['superdat']['size'];
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
cleardata();

if(isipbanned($uip,$ubr))
  {
if(!isshield(getuid_sid($sid)))
  {
  echo "<head>";
  echo "<title>Ip Block!</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/default_medium.css\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
  echo "<div><img src=\"../images/notok.gif\" alt=\"!\"/></div>";
  echo "<b>This IP address is blocked!!!</b><br/>";
  echo "<br/>";
  echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over<br/><br/>";
  $banto = mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_penalties WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
  $remain =  $banto[0] - time();
  $rmsg = gettimemsg($remain);
  echo "<b>Time Left: </b>$rmsg<br/>";
  echo "</p>";
  echo "<p align=\"center\"><form action=\"login.php\" method=\"get\">";
  echo "<b>Username:</b><br/><input align=\"center\" name=\"loguid\" style=\"-wap-input-format: '*x'\" size=\"12\" maxlength=\"12\"/><br/>";
  echo "<b>Password:</b><br/><input align=\"center\" type=\"password\" name=\"logpwd\" size=\"10\" maxlength=\"10\"/><br/>";
  echo "<input name=\"LOGIN\" type=\"submit\" value=\"Login!\"></form></p>";
  echo "<p align=\"center\"><br/>Not registered yet? <br/><a href=\"register.php\">Sign-Up</a><br/>";
  echo "<a href=\"index.php?action=terms&sid=$sid\">Site Rules</a><br/>";
  echo "</p>";
  echo "<p align=\"center\">";
  $onu = getnumonline();
  echo "Members Inside: $onu<br/><br/>";
  
  
  echo "<div><b>©2008-2009<br/>$sitename</b></div>";
  echo "</body>";
  echo "</html>";
  exit();
  }
}

if(($action != "") && ($action!="terms"))
  {
    $uid = getuid_sid($sid);
    if((islogged($sid)==false)||($uid==0))
    {
      echo "<head>";
      echo "<title>Error!!!</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/default_medium.css\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "You are not logged in<br/>";
      echo "Or Your session has been expired<br/><br/>";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }            
 }

//echo isbanned($uid);
if(isbanned($uid))
    {
      echo "<head>";
      echo "<title>Error!!!</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "<img src=\"../images/notok.gif\" alt=\"x\"/><br/>";
      echo "<b>You are Banned</b><br/><br/>";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
	$banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "<b>Time Left: </b>$rmsg<br/>";
      $nick = getnick_uid($banto[2]);
	echo "<b>By: </b>$nick<br/>";
	echo "<b>Reason: </b>$banto[1]";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }
    
    
echo "<small><p>";
addonline(getuid_sid($sid),"Uploading a File At Upload Center","");
    echo "<head>";
    echo "<title>$sitename Id Card</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
    echo "</head>";
    echo "<body>";
if ($upload="upload"&&$superdat_name){
if (!eregi("\.(mid|gif|bmp|midi|3gp|mp3|wav|jar|jad|m4a|jpeg|jpg|mpg|rtf|txt|doc|mpeg|si
|mmf|nth|thm|amr|png|wbmp|pdf|exe|mp4|avi|zip|rar|7z|sisx)$",$superdat_name)){
print "<b>Unsupported File Extention! Supported types are mid, gif, bmp, midi, 3gp, mp3, wav, jar, jad, jpeg, jpg, sis, mmf, amr, dat, mpg, png, wbmp, pdf, exe, mp4, avi, zip, rar, 7z, sisx</b>";
}else{
$superdat_name = preg_replace(
             '/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/'
             ,'',str_replace(array(' ','%20',"'"),array('_','_', ""),$superdat_name));
if(strlen($superdat_name)>53){ print "<b>File Name Is Too Long!</b>";
}else{
if (empty($superdat)) {
print "<b>No input file specified!!!</b>";
}else{	
$indiatime = time() + (12.5 * 60 * 60);
$date=date("l, FdS,  Y", $indiatime)."  ".date("h:i:s A", $indiatime);
$fsize=round($superdat_size/1024,1);
$exi1 = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_uploads WHERE filename='".$superdat_name."' AND filesize='".$fsize." KB'"));
if($exi1[0]>0){
	print "<b>File already exists with same name and file size!!!</b>";
	exit();
}
else{
$exi2 = mysql_fetch_array(mysql_query("SELECT COUNT(id), MAX(id) FROM ibwf_uploads WHERE filename='".$superdat_name."' AND filesize!='".$fsize." KB'"));
if($exi2[0]>0){
$superdat_name="1".$superdat_name;
$flag1="<br/>Filename already existed but file didnt match so it was renamed and prefixed witha 1";
}
}
echo mysql_error();
$ext = explode(".", strrev($superdat_name));
switch(strtolower($ext[0])){
	case "dim":
	     $type="audio";
	     break;
	case "idim":
	     $type="audio";
	     break;
	case "3pm":
	     $type="audio";
	     break;
	case "vaw":
	     $type="audio";
	     break;
	case "fmm":
	     $type="audio";
	     break;
	case "rma":
	     $type="audio";
	     break;
	case "a4m":
	     $type="audio";
	     break;
	case "fig":
	     $type="image";
	     break;
	case "gnp":
	     $type="image";
	     break;
	case "gpj":
	     $type="image";
	     break;
	case "gepj":
	     $type="image";
	     break;
	case "pmb":
	     $type="image";
	     break;
	case "pmbw":
	     $type="image";
	     break;
	case "pg3":
	     $type="video";
	     break;
	case "iva":
	     $type="video";
	     break;
	case "4pm":
	     $type="video";
	     break;
	case "gpm":
	     $type="video";
	     break;
	case "gepm":
	     $type="video";
	     break;
	case "cod":
	     $type="document";
	     break;
	case "ftr":
	     $type="document";
	     break;
	case "txt":
	     $type="document";
	     break;
	case "fdp":
	     $type="document";
	     break;
	case "piz":
	     $type="archive";
	     break;
	case "z7":
	     $type="archive";
	     break;
	case "rar":
	     $type="archive";
	     break;
	case "raj":
	     $type="apps";
	     break;
	case "daj":
	     $type="apps";
	     break;
	case "sis":
	     $type="apps";
	     break;
	case "xsis":
	     $type="apps";
	     break;
	case "exe":
	     $type="apps";
	     break;
	case "htn":
	     $type="apps";
	     break;
	case "mht":
	     $type="apps";
	     break;

}
move_uploaded_file("$superdat", "$ucdir/$superdat_name") or
die("Couldn't copy file.");
$mysql=mysql_query("INSERT INTO ibwf_uploads SET id='', uid='".$uid."', mime='".$type."', filename='".$superdat_name."', filesize='".$fsize." KB', description='".$desc."', date='".$date."', device='".$HTTP_USER_AGENT."', number='".$HTTP_MSISDN.$HTTP_X_MSISDN.$HTTP_X_NOKIA_MSISDN.$HTTP_X_NETWORK_INFO."', uip='".$REMOTE_ADDR."'");
$upplsel=mysql_fetch_array(mysql_query("SELECT plusses from ibwf_users WHERE id='".$uid."'"));
$afuppl=$upplsel[0]+10;
   mysql_query("UPDATE ibwf_users SET plusses='".$afuppl."' WHERE id='".$uid."'");

echo "<b>$superdat_name</b> has successfully been uploaded to the Uploads Center!$flag1";
}
}
}
}

?>
<?php
echo "<form align=\"center\" action=\"upload.php?sid=$sid\" method=\"post\" enctype=\"multipart/form-data\">";
?>»Uploading porn material will lead to your permanent banning from the site!<br/>
»Upload file size limit is 2MB<br/>
<b>Enter file description(Maximum 255 chars):</b><br/>
<input id="inputText" align="center" type="text" name="desc" maxlength="255"/><br/>
<b>Select File To Be Uploaded :</b><br/>
<input id="inputText" align="center" type="file" name="superdat"/><br/>
<input id="inputText" align="center" type="hidden" name="upload" value="upload"/>
<input id="inputButton" align="center" type="submit" name="submit" value="Upload File!"/><br/><br/> <b><u>You can upload files with folowing extentions:</u></b><br/>
Audio: mid, midi, mp3, wav, mmf, amr<br/>Image: gif, bmp, jpeg, jpg, png, wbmp<br/>Video: 3gp, mpg, avi, mp4 <br/>
Applications: jar, jad, sis, sisx, exe, nth, thm<br/>Archives:  zip, 7z, rar<br/>Documents: rtf, doc, txt, pdf<br/>
<hr/>
<?php 

echo "<br/><a href=\"share.php?sid=$sid\">Browse uploaded files</a>"; 
?>
</form>
</p></small>
<?php
echo "</body>";

?>
</html>
godzilla Developer · 119 posts #3

there is no folder for this upload.php

i just uploaded this share.php and upload.php

i also chmod 777 to upload.php but i still got above error

subzero Super moderator Fellow · 3,954 posts #4
switch(strtolower($ext[0])){ 
    case "dim": 
         $type="audio"; 
         break; 
    case "idim": 
         $type="audio"; 
         break; 
    case "3pm": 
         $type="audio"; 
         break; 
    case "vaw": 
         $type="audio"; 
         break; 
    case "fmm": 
         $type="audio"; 
         break; 
    case "rma": 
         $type="audio"; 
         break; 
    case "a4m": 
         $type="audio"; 
         break; 
    case "fig": 
         $type="image"; 
         break; 
    case "gnp": 
         $type="image"; 
         break; 
    case "gpj": 
         $type="image"; 
         break; 
    case "gepj": 
         $type="image"; 
         break; 
    case "pmb": 
         $type="image"; 
         break; 
    case "pmbw": 
         $type="image"; 
         break; 
    case "pg3": 
         $type="video"; 
         break; 
    case "iva": 
         $type="video"; 
         break; 
    case "4pm": 
         $type="video"; 
         break; 
    case "gpm": 
         $type="video"; 
         break; 
    case "gepm": 
         $type="video"; 
         break; 
    case "cod": 
         $type="document"; 
         break; 
    case "ftr": 
         $type="document"; 
         break; 
    case "txt": 
         $type="document"; 
         break; 
    case "fdp": 
         $type="document"; 
         break; 
    case "piz": 
         $type="archive"; 
         break; 
    case "z7": 
         $type="archive"; 
         break; 
    case "rar": 
         $type="archive"; 
         break; 
    case "raj": 
         $type="apps"; 
         break; 
    case "daj": 
         $type="apps"; 
         break; 
    case "sis": 
         $type="apps"; 
         break; 
    case "xsis": 
         $type="apps"; 
         break; 
    case "exe": 
         $type="apps"; 
         break; 
    case "htn": 
         $type="apps"; 
         break; 
    case "mht": 
         $type="apps"; 
         break; 

}

See this its your folders i guest the script has being modded to auto place files.

Now see type = "folder"; where it says make

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #5

So your folders are:

audio image video document archive apps

Also 0777 on your folders.;)

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

godzilla Developer · 119 posts #6

i maked that folders as u said bro and also i chmod to 777 but its still showing me above error

subzero Super moderator Fellow · 3,954 posts #7

i think your hoster blocked uploaders

tmp/phpRaMEQw where the file will hold to its done then it moves it when its 100%

but if tmp is chmod 555 change it to 600

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

godzilla Developer · 119 posts #8

my host not blocked uploader.bcoz my gallery is working good in which i m using wapdesire direct uploader gallery script.

and my tmp is 0755 rite now

subzero Super moderator Fellow · 3,954 posts #9

hmmmm ok

have you got addtypes ? in server ?

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #11

file types are ok to load

like

.zip .sis .jar

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

godzilla Developer · 119 posts #12

yes they are ok.

i can upload those files on my server

godzilla Developer · 119 posts #13

Anybody plz help me in this error. Plz help me.

subzero Super moderator Fellow · 3,954 posts #14

ok i can see your upload.php

You mite need to place it in one folder !

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

godzilla Developer · 119 posts #15

how can i place them in one folder.

can u plz give me example bro sub

godzilla Developer · 119 posts #17

i tried putting upload.php in image folder but it still not working.

let me say how i uploade my files.

i uploaded share.php and upload.php in that root in which my index.php is uploaded

i also maked folders apps,document,video,archive,image.audio in same root where i uploaded my index.php and also i chmod 777 to those 6 folders and also i put $ucdir = "./share"; in config.php and its not working at all.

it showing the same error i described above

godzilla Developer · 119 posts #19

yes i put .htaccess also but its not working yet php_flag register_globals on

i got error now

Warning: move_uploaded_file(./share/amisha_patel29e.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/godzilla/public_html/mysite/upload.php on line 270

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpatsMj3' to './share/photo.jpg' in /home/godzilla/public_html/mysite/upload.php on line 270 Couldn't copy file.

do i have to insert this codings in .htaccess file

AddType audio/AMR .amr
AddType video/3gpp .3gp
AddType video/3gpp .mp4
AddType application/octet-stream .sisx
AddType application/vnd.symbian.install .sis
AddType application/java-archive .jar
AddType text/vnd.sun.j2me.app-descriptor .jad
ErrorDocument 403 /403.htm
ErrorDocument 404 /404.htm
ErrorDocument 500 /500.htm
metulj Super moderator Principal · 1,726 posts #20

godzilla wrote: yes i put .htaccess also but its not working yet php_flag register_globals on

i got error now

Warning: move_uploaded_file(./share/amisha_patel29e.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/godzilla/public_html/mysite/upload.php on line 270

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpatsMj3' to './share/photo.jpg' in /home/godzilla/public_html/mysite/upload.php on line 270 Couldn't copy file.

do i have to insert this codings in .htaccess file

AddType audio/AMR .amr
AddType video/3gpp .3gp
AddType video/3gpp .mp4
AddType application/octet-stream .sisx
AddType application/vnd.symbian.install .sis
AddType application/java-archive .jar
AddType text/vnd.sun.j2me.app-descriptor .jad
ErrorDocument 403 /403.htm
ErrorDocument 404 /404.htm
ErrorDocument 500 /500.htm

where do you host??

funny i get exact same result lol

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close