Upload Error..

Started on the old forum in November 2011 · view the original in the archive · old links redirect here

4 replies · 432 views · started 15 years ago · 1 min read

4 participants
sky2kv Junior · 30 posts #1

Hi Guy's im facing this problem in upload.php...you see when im clicking on upload,it's bringing me back to the same page again..nothing is even being uploaded to the tables aswell...here's the code...

<?php include("../core.php"); include("../config.php"); connectdb(); $uip = getip(); $action = ($_GET["action"]); $sid = ($_GET["sid"]); $uid = getuid_sid($sid); $sid = ($_GET["sid"]); $site = ($_GET["site"]); $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]; if($action != "") { if(!islogged($sid)) { echo "<head>"; echo "<title>Error!!!</title>"; echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />"; echo "</head>"; echo "<body>"; echo " "; echo "You are not logged in "; echo "Or Your session has been expired "; echo "<a href=\"index.php\">Login</a>"; echo " "; echo "</body>"; echo "</html>"; exit(); } } echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html"/> <meta http-equiv="Cache-Control" content="no-cache" forua="true"/>'; echo "<title>$site_name Upload Files</title>"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/$theme[0]\">"; echo "</head>"; echo "<body>"; //include("../web/header.php"); echo ""; echo "**Fileshare uploader**"; echo ""; if ($upload="upload"&&$superdat_name){ if (!eregi("\.(gif|mid|midi|3gp|mpeg|mpg|mp4|mp3|wav|jar|jad|jpeg|jpg|sis|sisx|amr|zip|rar|thm)$",$superdat_name)){ print "**Unsupported File Extention!**"; }else{ $superdat_name = preg_replace( '/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/' ,'',str_replace(array(' ','%20',"'"),array('_','_', ""),$superdat_name)); if(strlen($superdat_name)>50){ print "**File Name Is Too Long!**"; }else{ if (empty($superdat)) { print "**No input file specified!!!**"; }else{ copy("$superdat", "files/$superdat_name") or die("Couldn't copy file."); $date= time(); $type = $_POST["dir"]; $text2 = $_POST["name2"]; $fsize=round($superdat_size/1024,1); $text = "&&$superdat_name&&$fsize KB&&$date&&$REMOTE_ADDR&&"; $fz = "$fsize KB"; if("$text"!="$check[1]"){ $mysql=mysql_query("INSERT INTO ibwf_uploads2 SET uid='".$uid."', filename='".$superdat_name."', filename2='".$text2."', dir='".$type."', descrip='".$name."', filesize='".$fsize." KB', date='".$date."', date2='".date("l")."', uip='".$REMOTE_ADDR."'"); echo mysql_error(); } echo "**$superdat_name** has successfully been uploaded to our uploader"; } } } } ?> <?php $post = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$uid."'")); if($post[0]<30) { echo "You Need **100 plusses** and **30 Post** to upload your files! "; } else { echo "<FORM align=\"left\" ACTION=\"upload.php?sid=$sid&amp;site=$site\" METHOD=\"POST\" ENCTYPE=\"multipart/form-data\">"; echo "Category: <select name=\"dir\" value=\"$dir[0]\">"; if($dir[0]=="1"){$selected=" selected=\"selected\"";}else{$selected="";} echo "<option value=\"1\"$selected>Applications</option>"; if($dir[0]=="2"){$selected=" selected=\"selected\"";}else{$selected="";} echo "<option value=\"2\"$selected>Games</option>"; if($dir[0]=="3"){$selected=" selected=\"selected\"";}else{$selected="";} echo "<option value=\"3\"$selected>Ringtones / Musics</option>"; if($dir[0]=="4"){$selected=" selected=\"selected\"";}else{$selected="";} echo "<option value=\"4\"$selected>Pictures</option>"; if($dir[0]=="5"){$selected=" selected=\"selected\"";}else{$selected="";} echo "<option value=\"5\"$selected>Themes</option>"; if($dir[0]=="6"){$selected=" selected=\"selected\"";}else{$selected="";} echo "<option value=\"6\"$selected>Videos</option>"; if($dir[0]=="7"){$selected=" selected=\"selected\"";}else{$selected="";} echo "<option value=\"7\"$selected>Zip Archives</option>"; if($dir[0]=="8"){$selected=" selected=\"selected\"";}else{$selected="";} echo "<option value=\"8\"$selected>other</option>"; echo "</select> "; echo "Filename: <input type=\"text\" name=\"name2\" size=\"20\" maxlength=\"200\"/> "; echo "Description: <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"200\"/> "; echo "File: <input type=\"file\" name=\"superdat\" size=\"20\"/> "; echo "<input type=\"submit\" value=\"Upload!\"/></form>"; echo "P/s:*Please select file category to upload or your files will be deleted!* "; echo "P/s:*Filename must be less then 50* "; echo " **Attentions** Only File .gif .mid .midi .3gp .mpg .mp4 .mp3 .wav .jar .jad .jpg .sis .sisx .amr .zip .thm are Allow "; if($site=="wap"){ echo " <a href=\"../fshare.php?action=main&amp;sid=$sid\">Uploaded Files</a> "; }else{ echo " <a href=\"../fshare.php?action=main&amp;sid=$sid\">Uploaded Files</a> "; } } if($site=="wap"){ echo "<a href=\"../index.php?action=main&amp;sid=$sid\"><img src=\"/images/home.gif\" alt=\"\"/>Home</a>"; }else{ echo "<a href=\"../index.php?action=main&amp;sid=$sid\"><img src=\"/images/home.gif\" alt=\"\"/>Home</a>"; } echo ""; //include("../web/footer.php"); ?> </body> </html>

Sometimes im wondering if the $site = ($_GET["site"]); is causing this..how can i change it?...thanks

mayurss786 Developer · 137 posts #2

check fopen_url is on or not and also try to give chmod 777 to that directory

sky2kv Junior · 30 posts #3

Awesome thanks...i'll try doing this, this afternoon...i will state if it works or not...

Mysterio Lead · 630 posts #4

I could be wrong but you are using copy() function, in this case you should copy from temporary file to your file where you want to store it. where do you value $superdat?

Why dont just use move_uploaded_file() ?

Guys, try to see what kind of code are you using? Its never enough to copy-paste someone's code!

mysterio.al - programming is a functional art

brand Senior · 391 posts #5

i might not be right but it looks like its some thing to do with this

upload.php?sid=$sid&site=$site

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

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