confused with uplaoding file.

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   confused with uplaoding file.
cybershot
CZ Super Newbie
cybershot has been a member for over 17 year's 17 Year Member
usa.gif oregon.gif
Gender: Male
Website:
Status: Offline
Joined: Jan 31, 2007
0.01 posts per day
Posts: 75
Points: 25
   
i am having trouble getting my upload script to work. well it's working i think. what happens is that i can go to the folder where i told the script to upload the file. and i can see the file, but i cannot get the file out of the folder. usning cpanel i can move the file, and delete the file, but if i try to delete it from the folder it says....could not delete file. no such file or directory. but i can see it there and i can see that it has mass. it's not 0 kb

here is the upload code that i am using

<?php
if (eregi("block-Block_Creator.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
include("header.php");
$index = 0;
OpenTable();
$target = "../main/cyber/ ";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;

//This is our size condition
if ($uploaded_size > 350000)
{
echo "Your file is too large.<br>";
$ok=0;
}

//This is our limit file type condition
if ($uploaded_type ==".php")
{
echo "No PHP files<br>";
$ok=0;
}

//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
CloseTable();
?>


and also for some reason. the file type condition doesn't work. it is letting me upload php files, i would also like to add other types of files to limit, but i am not sure of the proper syntax. whould it be php, exe, ect.....


Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum