Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
ethana
Hangin' Around



Joined: Jan 05, 2006
Posts: 32
Location: Phoenix, AZ

PostPosted: Sun Jan 08, 2006 1:16 pm Reply with quote

Hey all..im having some issues in writing a small product catalog for someone. In my module i have obv. a form that allows uploading of files. On the next page with a print_r command in php it fully prints out all the details of $_FILES:
Code:


Array (

 [product_image_big] => Array ( [name] => rainbow_pak_big.jpg [type] => image/jpeg [tmp_name] => /tmp/phpLmUUuc [error] => 0 [size] => 24659 )

 [product_image_small] => Array ( [name] => rainbow_pak_small.jpg [type] => image/jpeg [tmp_name] => /tmp/phpNe0ysB [error] => 0 [size] => 10468 )
 )


So no problem there...on the same page load where i print this out...im trying to move these from their temp location to their perm. home.

Code:
   $upload_dir = '/modules/Wikki_Prodct_Catalog/temp_images/';

    $upload_file_bg = $upload_dir . basename($_FILES['product_image_big']['name']);
    $upload_file_sm = $upload_dir . basename($_FILES['product_image_small']['name']);
move_uploaded_file($_FILES['product_image_big']['tmp_name'], $upload_bg);


This absolutly refuses to work...ive tried specifying a path from my root of the website and even from the very root of the users home folder. Ive tried copy..and ive tried rename. The temp_images folder is chmod'd to 777. Any ideas? All examples say that this is correct and im making this move on the same script load as the processing of the form that gets the file.

Thanks all.

_________________
"Who the h*ll does the QA team think they are telling me im not meeting requirements?!?" 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Jan 08, 2006 6:52 pm Reply with quote

What is the error you are getting (check your error log - make sure you have $display_errors=true; in your config.php)? Have you checked out this page http://us3.php.net/manual/en/function.move-uploaded-file.php ?
 
View user's profile Send private message
ethana







PostPosted: Sun Jan 08, 2006 8:35 pm Reply with quote

I dont get direct access to apache error logs on my host. They do give a function to place in my code or include:

Code:
error_reporting(0); 

   $old_error_handler = set_error_handler("userErrorHandler");
 
   function userErrorHandler ($errno, $errmsg, $filename, $linenum,  $vars)
   {
     $time=date("d M Y H:i:s");
     // Get the error type from the error number
     $errortype = array (1    => "Error",
                         2    => "Warning",
                         4    => "Parsing Error",
                         8    => "Notice",
                         16   => "Core Error",
                         32   => "Core Warning",
                         64   => "Compile Error",
                         128  => "Compile Warning",
                         256  => "User Error",
                         512  => "User Warning",
                         1024 => "User Notice");
      $errlevel=$errortype[$errno];
 
      //Write error to log file (CSV format)
      $errfile=fopen("errors.csv","a");
      fputs($errfile,"\"$time\",\"$filename:
      $linenum\",\"($errlevel) $errmsg\"\r\n");
      fclose($errfile);
 
      if($errno!=2 && $errno!=8) {
         //Terminate script if fatal errror
         die("A fatal error has occured. Script execution has been aborted");
      }
   }


They dont clarify what the parameters are exactly (as in where errorno should come from exactly, etc).

on the $display_errors var that you speak of...i placed it in my config.php for my nuke install and it didnt display anything. The upload works fine...i already visited the link you provided and in fact copied exactly their html and php example and ran it. No good. The only thing i changed was the path to move the file too. I copied and pasted the path and ive chmod'd all to 777. Im having this issue on two totally different servers and im just baffeled.
 
ethana







PostPosted: Sun Jan 08, 2006 8:42 pm Reply with quote

Wait, on one of my other servers i did have this:

[Sun Jan 8 18:44:26 2006] [error] [client xx.xxx.xxx.xxx] File does not exist: /home/sites/sitexx/web/home/sites/www.xxx.com/web/nuke_site/modules/Wikki_Product_Catalog/temp_images/rainbow_pak_big.jpg
 
ethana







PostPosted: Sun Jan 08, 2006 8:51 pm Reply with quote

Still investigating but the way the function operates (the way i understand it at least) is to provide the path and new file name...even the examples show it this way. This makes me think that this is a cryptic error message that isnt pointing directly to the problem but rather a clue along the path. Pain in the arse and time eater so far. Any help is appreciated and thanks for at least getting me to try and access my error log raven.
 
ethana







PostPosted: Mon Jan 09, 2006 2:30 am Reply with quote

Ok, got this solved...not exactly sure how as i tried a lot of different combination of things. I think overall it had to do with me putting a '/' on the front of the new path and also a lot of permissions of the folder and its parents...one big waste of time. Not much learned on this one Wink
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
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 can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©