kernelgpf Posted November 24, 2006 Share Posted November 24, 2006 My problem is that the code is displaying that the file was successfully uploaded to the directory "/home/www/ffpb2.100webspace.net/pendingimages/$filenamehere", but it really isn't being uploaded. Could somebody point out my problem?[code]$afile=$_FILES['file']['name'];if(!empty($afile)){//Change this to the directory you would like to upload files to.//Change these to allowed files types users can upload$allowedfile[] = "image/gif"; //.gif$allowedfile[] = "image/pjpeg"; //.jpeg$allowedfile[] = "image/jpg"; //.jpg$allowedfile[] = "image/png"; //.png$allowedfile[] = "image/psd"; //.psd//Check to see if file exists | If it does, then we stop the process, although if it doesnt then we continue$fileplace="$v/pendingimages/$afile";$directory="$v/pendingimages/";$gfileplace="$v/gallery/$afile";if(file_exists($gfileplace) == "1") {$is_uploaded = "failed";echo 'Sorry! This file already exists. ';exit(); //If $is_upload = failed, then we stop the uploading process}if(!in_array($_FILES["file"]["type"],$allowedfile)) {$is_uploaded = "failed";echo 'Sorry! Wrong file type, "'.$_FILES["file"]["type"].'" is not allowed. ';exit(); //If $is_upload = failed, then we stop the uploading process}//Now, if $is_uploaded does NOT = failed, we remove invalid characters in the filename, and replace all spaces with underscores if($is_uploaded != "failed") { $replace = array("$","%","#","@","!","&","^","*","(",")","-"," "); $new = str_replace($replace,"",$_FILES["file"]["name"]); //Now we upload the file and check for errors$variable=$_FILES["file"]["tmp_name"]; if(move_uploaded_file($variable, $fileplace)){print "$fileplace";$imagetitle=$_POST['imagetitle'];mysql_query("insert into gallerymaybes(filename,imagetitle,submittedby)values('$afile','$imagetitle','$sid')")or die(mysql_error());print "Image successfully sent in, and if approved, will be added to the gallery. You will earn a gallery point and receive a message for any images accepted."; } else { echo 'Error: Uknown Error'; exit(); }[/code] Quote Link to comment Share on other sites More sharing options...
kernelgpf Posted November 24, 2006 Author Share Posted November 24, 2006 $v is the server root, for further clarification. Quote Link to comment Share on other sites More sharing options...
kernelgpf Posted November 24, 2006 Author Share Posted November 24, 2006 bump. Quote Link to comment Share on other sites More sharing options...
kernelgpf Posted November 24, 2006 Author Share Posted November 24, 2006 bump. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted November 25, 2006 Share Posted November 25, 2006 $docroot = $_SERVER['DOCUMENT_ROOT'];When you are ready to actual send the file put$docroot . "path"which in your case looks like$docroot . "pendingimages" Quote Link to comment Share on other sites More sharing options...
taith Posted November 25, 2006 Share Posted November 25, 2006 also... i had this once... if the file permissions on the folder your moving it too arnt set properly, it wont move... even though php may say it did... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.