Go Back   Novahq.net Forum > Computers > Web design and Programming
FAQ Community Calendar Today's Posts Search

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #21  
Old 01-03-2009, 02:26 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
I dunno how to...

Seems like 3mb still won't fly.
__________________
Reply With Quote
  #22  
Old 01-03-2009, 02:41 PM
SilentTrigger is offline SilentTrigger
-1PARA-

Join Date: Sep 2002
Location: Sweden
Posts: 3,972

Can you post the upload.php?

fclose is used to close a temp file.
__________________
-1PARA-AlexKall

My photography website




Last edited by SilentTrigger; 01-03-2009 at 03:13 PM.
Reply With Quote
  #23  
Old 01-03-2009, 03:24 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
PHP Code:
<?php
require_once("../../includes/site_common.php");
if(!(
$permissions->validateRole(array(NEWS_ADMIN,NEWS_JOURNALIST))))
{
  
showError("You do not have permission to add news");
  exit;
}
   
$user $context['user']['id'];    
   
$articleId $sql->getPostVar("articleid");
   
   
$types = array("image/gif","image/jpg","image/png","image/pjpeg","image/jpeg");
     
   if(
$sql->countRows("SELECT * FROM `news` WHERE `sid`=$articleId") == 0)
   {
      
showError("The article ID provided for this file does not exist!");
      exit;
   }
   elseif(
$sql->countRows("SELECT * FROM `news` WHERE `sid`=$articleId") > 1)
   {
      
showError("The article ID is used for more than one article!");
      exit;   
   }
   
   if (
count($_FILES['files']) > 0)
   {
     foreach (
$_FILES["files"]["error"] as $key => $error)
     {
 
       if (
$error == UPLOAD_ERR_OK)
        {
         
$tmp_name $_FILES["files"]["tmp_name"][$key];
         
$name=strtolower($_FILES["files"]["name"][$key]);
         
$ext=substr(strrchr($name"."), 1);
         
           if(
in_array($_FILES["files"]["type"][$key], $types))
           { 
              if(
$_FILES["files"]["size"][$key] < 1500000)
              {
                
$fileId doUpload($sql$tmp_name$name$ext$user$articleId);                  
                
?>
                  <script language="javascript" type="text/javascript">
                    parent.hideStatusDiv();
                    parent.showFile("<?php echo $name?>","<?php echo $fileId?>");
                  </script>             
                <?php
              
}
              else
               
showError("Your file is too large, it must be less than 1.5 MB");
               
           }
           else
           {
              
showError("That file type is not allowed!");        
           }         
         }
         else
         {
            
showError("There was a problem uploading your file, try again.");
         }
      } 
// End ForEach
  
}
  else
  {
    
showError("No file has been submitted");
  }
  
  function 
doUpload(&$sql$tempLocation$name$ext$user$articleId)
  {
    
$dategmdate("j F Y, h:i:s A")." GMT";
    
$upload $sql->simpleQuery("INSERT INTO `newsuploads` (`date`, `articleid`,`memberid`) VALUES ('$date', '$articleId', '$user')");
    
$fileId $sql->insertId;
    if(
$upload)
    {
      if (!(
file_exists("../../uploads/news")))
      {
       
mkdir("../../uploads/news/");
      }
      
$location "uploads/news/article_".$articleId."_".$fileId.".".$ext;
      
$actualFileLocation "../../".$location;
      
move_uploaded_file($tempLocation"../../".$location);
      
      
$medium 'uploads/news/article_'.$articleId.'_'.$fileId.'_med.'.$ext;
      
$thumb 'uploads/news/article_'.$articleId.'_'.$fileId.'_thumb.'.$ext;
      
      
$sql->simpleQuery("UPDATE `newsuploads` SET `filelocation` = '$location', `mediumlocation`='$medium',`thumblocation`='$thumb' WHERE `sid`='$fileId'");
      
      
$theClass = new ImageCropper();
      
$theClass->makeThumb($actualFileLocation"../../".$thumb);
      
$theClass->makeOtherSize($actualFileLocation"../../".$medium ); 
      return 
$fileId;
    }
  }
  
  function 
showError($error)
  {
    
?>
    <script language="javascript" type="text/javascript">
       parent.hideStatusDiv();
       parent.showError("<?php echo $error?>");
    </script>             
    <?php  
  
}
  

?>
__________________
Reply With Quote
  #24  
Old 01-03-2009, 03:45 PM
SilentTrigger is offline SilentTrigger
-1PARA-

Join Date: Sep 2002
Location: Sweden
Posts: 3,972

Not sure how the $_FILES global work, wasn't a function when I did uploading in PHP that I know of atleast.

They indeed don't seem to close files anymore, I'm stumpted. It was a practise that was always to be done before

Sorry, I'm too outdated
__________________
-1PARA-AlexKall

My photography website




Last edited by SilentTrigger; 01-03-2009 at 03:52 PM.
Reply With Quote
  #25  
Old 01-03-2009, 07:02 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
From what I was told it only contains info about the file so it isn't a problem. The rest of the member was other included stuff.
__________________
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question ƒalcon Joint Operations 3 10-12-2006 04:45 PM
just a question Lucky Feedback / Novahq.net Support 3 07-29-2005 11:10 AM
Question SMITIE Sigs and Graphics 8 07-18-2005 07:20 PM
Question :D V99 Delta Force 7 09-10-2003 12:23 AM
i have a question †W¡§†ëÐ «M§§» Hardware and Software 5 08-23-2003 09:39 AM


All times are GMT -5. The time now is 01:07 PM.




Powered by vBulletin®