1
znaxx
Problems uploading avatars and images
  • 2003/11/17 12:06

  • znaxx

  • Just popping in

  • Posts: 9

  • Since: 2003/11/17


I can't upload images to my server.
When I try yto upload an avatar I get an error msg saying that it's an invalid file format. I've hecked and the avatar is in .gif and wel whitin the required size.
I can however upload avatars through the admin module.
I also have the same problem with the cdbase module. I can't upload an images at all.
I've checked and the upload dir is chmod 777.
Appriciate any help...

Other then this, thanks alot for a kick ass product.

2
znaxx
Re: Problems uploading avatars and images
  • 2003/11/20 13:53

  • znaxx

  • Just popping in

  • Posts: 9

  • Since: 2003/11/17


Anyone know the answer to this ?
Still haven't figured it out and any help would be greatly appreciated.

3
ackbarr
Re: Problems uploading avatars and images

do you get any error messages if you turn on php debugging? Sounds like a php upload server config problem to me, and if so, there should be a php error after the file upload.

4
ackbarr
Re: Problems uploading avatars and images

* sorry - just re-read your first post. Still interested if there are any php debug errors, but ignore my later comments.

5
lsrytlee
Re: Problems uploading avatars and images
  • 2003/11/20 17:26

  • lsrytlee

  • Just popping in

  • Posts: 8

  • Since: 2003/11/17


Quote:

znaxx wrote:
I can't upload images to my server.
When I try yto upload an avatar I get an error msg saying that it's an invalid file format. I've hecked and the avatar is in .gif and wel whitin the required size.
I can however upload avatars through the admin module.
I also have the same problem with the cdbase module. I can't upload an images at all.
I've checked and the upload dir is chmod 777.
Appriciate any help...

Other then this, thanks alot for a kick ass product.


How about the file manager in newbb? Is it able to upload files too? As ackbarr said u are better to open the php debug mode to see is there any message show u?

6
znaxx
Re: Problems uploading avatars and images
  • 2003/11/20 18:16

  • znaxx

  • Just popping in

  • Posts: 9

  • Since: 2003/11/17


When I try to upload an image the php debug gives me this msg:

Warning [PHP]: getimagesize(): open_basedir restriction in effectFile(/tmp/phpL19NoJis not within the allowed path(s): (/var/www/hotels/) in file class/uploader.php line 183


I'm no php guru so I have no idea what to do...
Appreciate any help I can get....

7
ackbarr
Re: Problems uploading avatars and images

open_basedir is a php configuration setting that limits what directories a php application can access. This error occurs because the upload_dir setup for php /tmp/ is outside the paths you are allowed to access. This has to be set at either the php configuration or web server configuration level. So you can either

1) Convice whoever hosts your website to change this configuration value so that you can manipulate uploaded files.
2) move your site to a host that allows you to access the specified upload_dir.

8
znaxx
Re: Problems uploading avatars and images
  • 2003/11/21 16:04

  • znaxx

  • Just popping in

  • Posts: 9

  • Since: 2003/11/17


Ok. My webhost is http://www.1go.dk and according to them this php script will work for uploading files:

<?php 

// general configuration 

$upload_path "docs/";  // path to your upload directory 
$extval_use 1// turns on/off extension validation 
// forbidden extensions 
$extval = array("php""php3""php4""asp""bat""exe",  
                
"com""jsp""cfml""shtml""dtcl"); 
$filesize_limit_use 1// turns on/off size check 
$filesize_limit 200// file size limit (in kB) 

// language customization 
$message["fileisbig"] = "Filen er større end den tilladte størrelse på (" 
                        
$filesize_limit "kB)"
$message["invext"] = "Filer af denne type kan ikke uploades!"
$message["incomplete"] = "Upload lykkedes ikke."
$message["complete"] = "Upload er fuldført."
$message["uploadbutton"] = "Upload"
$message["uploadtxt"] = "Fil, der skal uploades: "
$message["fileexists"] = "Filen findes i forvejen!"

$rc 0

if ( isset(
$HTTP_POST_VARS["upload"]) ) { 

   
$orig_name $HTTP_POST_FILES['userfile']['name']; 

   
$filename ereg_replace("[^a-z0-9._]""",  
                
ereg_replace (" ""_",  
                 
ereg_replace("%20""_",  
                  
strtolower($orig_name)))); 

   
// <filesize> 
   
if($filesize_limit_use=1) { 

      
$filesize $HTTP_POST_FILES['userfile']['name'] / 1024//filesize in kB 

      
if($filesize_limit $filesize) { 
         echo 
"<p><font color='red'><center>" 
              
$message["fileisbig"]."</font></center></p>"
         
$rc 1
      } 
   } 
   
// </filesize> 

   
if ( $rc == ) { 
      
// <extension_validate> 
      
if($extval_use=1) { 

         
$extget substrstrrchr($filename"."), 1); 

         
$found in_array($extget$extval); 

         if ( 
$found ) { 
            echo 
"<p><font color='red'><center>" 
               
$message["invext"]."</font></center></p>"

            
$rc 2
         } 
      } 
      
// </extension_validate> 
   


   if ( 
$rc == ) { 
      
// <file exists verification> 
      
echo "<p><center>Trying to upload to: "  
         
$upload_path $filename "</center></p>n"

      if ( 
file_exists($upload_path.$filename) ) { 
         echo 
"<p><font color='red'><center>" 
            
$message["fileexists"]."</font></center></p>"

      } else { 
         if( 
move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'],  
                   
$upload_path.$filename) ) { 
            echo 
"<p><center>" $message["complete"]."</center></p>"
         } else { 
            echo 
"<p><font color='red'><center>" 
               
$message["incomplete"]."</font></center></p>"
         } 

      } 
      
// </file exists verification> 
   




echo 

<html><head></head><title>Upload-script</title><body> 
<h3>Upload filer</h3><br><br> 
<form enctype='multipart/form-data' method='post' action=''> 
<input type='hidden' name='action' value='upload'> 
<table frame=box rules=none border=0 cellpadding=2 
       cellspacing=0 align='center'> 
   <tr> 
      <td>"
.$message["uploadtxt"]."</td> 
      <td><input type='file' name='userfile'> <input type='submit' name ='upload' 
                 value='"
.$message["uploadbutton"]."'></td> 
   </tr> 
   <tr> 
      <td></td> 
      <td></td> 
   <tr> 
</table> 
</form>"


?>



Is there anyway I can modify the upload script in XOOPS so that it will work like this one?


9
ackbarr
Re: Problems uploading avatars and images

we are working on a possible solution to work around open_basedir() restrictions on file uploading. I should know more this weekend

10
indream
Re: Problems uploading avatars and images
  • 2005/11/19 16:13

  • indream

  • Not too shy to talk

  • Posts: 170

  • Since: 2004/9/21


Quote:
Danger [PHP]: getimagesize(): open_basedir restriction in effect. File(/var/tmp/phpV4afZ7) is not within the allowed path(s): (/usr/home/SITE/:/usr/lib/php:/usr/local/lib/php:/tmp) in file /usr/home/SITE/public_html/class/uploader.php line 190
Danger [PHP]: getimagesize(/var/tmp/phpV4afZ7): failed to open stream: Operation not permitted in file /usr/home/SITE/public_html/class/uploader.php line 190


I have same problem now.

Xoops 2.0.13.2
Operating system FreeBSD
Kernel version 5.4-RELEASE-p6
Machine Type i386
Apache version 1.3.33 (Unix)
PERL version 5.8.7
PHP version 4.3.11
MySQL version 4.0.26

can anyone help me ?

Login

Username:
Password:

Lost Password? Register now!

Who's Online

46 user(s) are online (28 user(s) are browsing Support Forums)


Members: 0


Guests: 46


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jun 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits