Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1782 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

php upload script problem

Thread title: php upload script problem
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
08-07-2006, 04:30 PM
#1
Nightscream is offline Nightscream
Status: Junior Member
Join date: Aug 2006
Location:
Expertise:
Software:
 
Posts: 58
iTrader: 0 / 0%
 

Nightscream is on a distinguished road

  Old  php upload script problem

I'm creating my own upload script but It won't work
if I want to upload something i get
File '' not uploaded
It's something with the $_FILES i think but don't know how to fix it
PHP Code:
if( isset( $_POST['Upload'] )) {
    
$upload_dir $_SERVER['DOCUMENT_ROOT'] . "images/";
    
$MaxFileSize 800000000;
    
$filename $_FILES['file']['name'];
    
$filesize $_FILES['file']['size'];
    
$filetmpname $_FILES['file']['tmp_name'];
    
$allowed_types = array( "jpg""gif""png" );
    
$filetype substr($filename, -33);
    
//$Thumb = $_POST['Thumbnail'];
    //$Water = $_POST['Watermarking'];
    
    
if($filename) {
    echo 
'test';
    
$error 0;
        if((
$filesize $MaxFileSize) | $filesize ) {
            
$error 1;
            
$errmsg .= "Your File is to large, (Max File size: 8MB)";
        }
        if( !
in_array$filetype$allowed_types )) {
            
$error 1;
            
$errmsg .= "Your File is the wrong type, (Allowed Types: Gif, Jpg, Png)//change to the allowed types";
        }else  {
            
$error 0;
        }
        if( 
$error ) {
            die( 
"$errmsg);
        }else{                
            
$num rand19999 );
            
$new_filename $num.$filename;
            
$upload move_uploaded_file($filetmpname"$upload_dir.$new_filename");
            if(
$Thumb ) {
                
CreateThumb($filetmpname);
            }
            if(
$Water ) {
                
CreateWatermark($filetmpname);
            }
            if( 
$upload ) {
                echo 
'Upload Succesfull';
                
//echo "<meta http-equiv='refresh' content='0'; URL='?image=$upload_dir.$new_filename'>";
            
}else {
                die( 
"Cound not upload the file, please try again" );
            }
        }
    }else{
        echo 
"File '$filename' not uploaded";
    }
}
?> 

     


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

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed