Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > PHP Programming
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 02-15-2007, 10:17 AM
  #1
Kiter G Man
Registered User
 
Join Date: Dec 2006
Location: Mudeford, Dorset, UK
Posts: 19
iTrader: (0)
Kiter G Man is an unknown quantity at this point
Exclamation $_FILES help

Hiya, I've got this basic script to upload and rename a file, but it's failing.

Here is the input field on the html page:
Code:
<td width="81%"><input class="width100" type="file" name="gmtd_page_form1_image" /></td>
And this is the php to rename and upload the image:
PHP Code:
<?php
            
// Image Upload
                
$gmtd_page_a_1_iu_nfn "story-";
                
$gmtd_page_a_1_iu_nfn .="$gmtd_page_a_getstoryid_id";
                echo 
"<i>$gmtd_page_a_1_iu_nfn</i>";
                
$gmtd_page_a_1_iu_temp_filename $_FILES['gmtd_page_form1_image']['name'];
                echo 
"<b>$gmtd_page_a_1_iu_temp_filename</b>";
                
$gmtd_page_a_1_iu_ext explode('.',$gmtd_page_a_1_iu_temp_filename);
                
$gmtd_page_a_1_iu_ext $gmtd_page_a_1_iu_ext[count($gmtd_page_a_1_iu_ext)-1];
                
$gmtd_page_a_1_iu_nfn $gmtd_page_a_1_iu_nfn.".".$gmtd_page_a_1_iu_ext;
                
$gmtd_page_1_iu_uploaddir './userfiles/storypics/';
                
$gmtd_page_a_1_iu_uploadfile $gmtd_page_1_iu_uploaddir $gmtd_page_a_1_iu_nfn;
                if (
move_uploaded_file($_FILES['gmtd_page_form1_image']['tmp_name'], $gmtd_page_a_1_iu_uploadfile)) 
                    { 
                    
$gmtd_page_a_1_iu_saveimgurl=mysql_query("UPDATE `gmtd_story_stories` SET `imageurl` = '$gmtd_page_a_1_iu_nfn' WHERE `id` = '$gmtd_page_a_getstoryid_id' LIMIT 1"$db) or die("$gmtd_config_ermsg_12");
                    
header ("Location: saved.php"); exit();
                    } 
                else 
                    { 
header ("Location: failed.php"); exit(); }
                
            }    

?>
The image is just not being uploaded. I've check the permissions of the upload folder and it is set to 0777. It appears that the $_FILES array is blank - when I added code in to display the image name, nothing was displayed :S

All help appreciated,
Thanks,
George
Kiter G Man is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-15-2007, 02:58 PM
  #2
ScareCrowe
Myrmidon (Level 12)
 
ScareCrowe's Avatar
 
Join Date: Nov 2006
Location: Bloomington Illinois
Posts: 156
iTrader: (0)
ScareCrowe will become famous soon enoughScareCrowe will become famous soon enough
Are you using _GET or _POST? I had same issue with mine until I realized that uploads only seem to work with _POST not _GET.

Not sure if thats the case with yours, but you didnt put the form tag there so thought I would mention it.
ScareCrowe is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-17-2007, 11:15 AM
  #3
scoutt
Mister Admin to you
 
scoutt's Avatar
 
Join Date: Jul 2001
Posts: 30,867
iTrader: (0)
scoutt is a jewel in the roughscoutt is a jewel in the roughscoutt is a jewel in the roughscoutt is a jewel in the rough
can you post the form?
__________________
Have a Script or Snippet you want to share?

WWW Standards: HTML 4.01, CSS2.1, CSS3, XHTML 1.0
PHP Standards: PHP Standards
scoutt is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart



 
 


 
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
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 03:49 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.