Quantcast
Channel: RaGEZONE - MMO Development Forums
Viewing all articles
Browse latest Browse all 35193

PHP A Directory out side of its current one,

$
0
0
Ok so i am uploading a file and i have two issues

FULL CODE
PHP Code:

<?php
if(isset($_FILES['image']))
                    {
                        
$errors = array();
                        
$allowed_ext = array('Cct','cct','CCT');
                        
$file_name $_FILES['image']['name'];
                        
$end explode('.'$file_name);
                        
$file_ext strtolower(end$end)); 
                        
$file_size $_FILES['image']['size'];
                        
$file_tmp $_FILES['image']['tmp_name'];
                        
                        
print_r($file_name);
                        
                        if(
in_array($file_ext$allowed_ext) === false)
                        {
                            
$errors[] = 'That file type is not aloud';
                        }
                        if(
$file_size 5242880)
                        {
                            
$errors[] = 'Incorrect File Or File Is To Big';
                        }
                        if(empty(
$errors) === true)
                        {
                            if(
move_uploaded_file($file_tmp'v18/furni/'$file_name))
                            {
                            echo 
'  CCT has been upoaded';
                            }
                            else 
                            {
                                echo 
'error';
                            }
                        }
                        else
                        {
                            foreach (
$errors as $error)
                            {
                                echo 
$error '<br/>';
                            }
                        }
                    }

?>

<form action="delz.php" method="POST" enctype="multipart/form-data">
     <p>
     Upload CCT File First:  <input type="file" name="image"/>
   <input type="submit" value="upload" />
   </p>
</form>

Page it loads when file is uploaded
PHP Code:

<html>

<form action="create.php" method="POST">
    folder name  <input type="text" name="name">
<input type="submit" value="Create">     
     </form>
      
      </html>
      
      
<?php

$path 
".";

$dir opendir($path) or die ("not good zac");





echo
"<a href='$file>$file</a><a href='delete.php'><img src='del.png></a><br>";



?>

Ok first issue,

On the first code where it says v18/furni/ that is a issue
Because the FIRST code is located in localhost/cct/uploader/uploader.php(the first codes page)
And v18/furni is located in localhost/cct/v18/furni
So when i upload the file it trys to go to localhost/cct/uploader/v18/furni
But i want the file to be sent to localhost/cct/v18/furni
with out having to move the file uploader out side of its current filder


An the second issue is.. nothing to worrie about untill first issue is solved,

Viewing all articles
Browse latest Browse all 35193

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>