UK Webmaster Talk - Online Marketing - SEO


 

Upload Error

This is a discussion on Upload Error within the Php and MySQL forums, part of the Programming / Scripting / Coding category; i have made this form where a person enters trainer details and an image,when i submit the image isn't uploaded ...


Go Back   UK Webmaster Talk - Online Marketing - SEO > Website Design & Development > Programming / Scripting / Coding > Php and MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Notices

Reply

 

LinkBack Thread Tools Display Modes
Old 08-05-2005, 19:26   #1 (permalink)
WMT Addict
 
Join Date: Apr 2005
Location: Brighton,UK
Posts: 162
iTrader: 0 / 0%
asgsoft is on a distinguished road
Default Upload Error

i have made this form where a person enters trainer details and an image,when i submit the image isn't uploaded but it returns that "invalid file"

PHP Code:

<?php

$type 
$_FILES['userfile']['type'];

if ( (
$type == 'image/png' ) || ($type == 'image/gif' ) || ($type == 'image/pjpeg' ) ) {

move_uploaded_file($_FILES['userfile']['tmp_name'], "Upload/" $_FILES['userfile']['name']);

echo 
"Upload Complete!";



else {

     die (
"Invalid file type");

}

/* file: regprocess.php */ 

/* wrriten: 3-31-05 */ 

if(isset($_POST['register'])) 



//oodles of variables from teh form 

$name $_POST['name'];

$make $_POST['make']; 

$colour $_POST['colour']; 

$discription_1 $_POST['discription_1']; 

$discription_2 $_POST['discription_2']; 

$price $_POST['price']; 

$stock $_POST['stock'];

$image_dir $image_dir $_FILES['userfile']['name']; 

//make sure them gooses filled in everything 

$errors 0

$emessage "<center><font face=\"Verdana\">Sorry, we enounctered the following errors when processing your registration:<br /><ul>"

if(empty(
$name) || empty($make)|| empty($colour)|| empty($discription_1)|| empty($discription_2)|| empty($price)|| empty($stock) || empty($image_dir)) 



$errors 1

$emessage .= "<li>Sorry, you must fill in <strong>all</strong> fields. Please go back and try again.</li>"



 

//if the gooses made errors, show em' 

if($errors != 0



$emessage .= "</font></center>"

die(
"$emessage"); 



 

//connect to el database 

//edit settings to yours, you goose you! 

mysql_connect("localhost""root""") or die(mysql_error()); 

//change this to your DB's name 

mysql_select_db("school") or die(mysql_error()); 

//perform query, inseting user submitted data 

mysql_query("INSERT INTO school (make,name,image,colour,trainer_info_1,trainer_info_2,stock,price ) VALUES ('$make','$name','$image_dir','$colour','$image_dir','$discription_1','$discription_2','$stock','$price')") or die(mysql_error()); 

//give them a nice pat on the back for doing everything just right 

echo("<center><font face=\"Verdana\">Thanks for registering. We will get back to you as soon as possible.</font></center>"); 



?>
asgsoft is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-05-2005, 19:45   #2 (permalink)
Moderator
 
Join Date: Mar 2005
Location: Barnsley, UK
Posts: 1,001
iTrader: 0 / 0%
Wistow has a reputation beyond reputeWistow has a reputation beyond reputeWistow has a reputation beyond reputeWistow has a reputation beyond reputeWistow has a reputation beyond reputeWistow has a reputation beyond repute
Default

You have an error in ($type == 'image/pjpeg' ) ) it should be ($type == 'image/jpeg' ) ) or ($type == 'image/jpg' ) )

Also make sure the upload folder is called Upload instead of upload as this is what you specified in the script.

Craig
Wistow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
error, upload

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Parse error, me = angry Lewis Website Design Forum 12 27-07-2005 14:37
Not Acceptable Error Lewis Website Design Forum 1 25-07-2005 12:47
UploadImago.net - Upload your images for free! Blazin Ads, Offers & Services 40 21-07-2005 21:19
aWstats error: says that ask.co.uk has... robertall Search Engine Optimisation (SEO) 5 22-05-2005 10:57
403 forbidden error on my site! robertall Website Development Forum 1 27-01-2005 18:08


All times are GMT +1. The time now is 18:25.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
UK Webmaster Forum © WebmasterTalk.co.uk | Design by Forbairt

Ad Management by RedTyger

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41