473,385 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

I need help with this code.

Hi, I need help for my program.

I'm new With PHP but i have programming skills in VB so it's quit easy to understand this language, however. i got my self in some problems that i don't understand.

I made a form that should add a record to a database and upload a picture
to a databasepictures folder

the problems is it doesn't upload the selected file.
and $_files vars are empty

when I do a $_request first, The filename is stored like "C:\\folder\\test.jpg"

Please help

This is my form it as PHP in it to get de details from my database

<form name="form1" method="post" action="index.php">
<?
$user="myusername";
$password="mypassword";
$database="mydatabase";
$pro_id=$_POST['pro_id'];
$pro_type=$_POST['pro_type'];
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM pro_index";
mysql_query($query);
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
?>
Product type
<select name="type" size="1">
<?
while ($i < $num) {
$pro_id=mysql_result($result,$i,"pro_type_code");
$pro_type=mysql_result($result,$i,"Pro_type");
echo "<option>$pro_type</option>";
$i++;
}
mysql_close();
?>
</select>
<?
$pro_code_our++;
Echo "<br>Product number = BS$pro_code_our </p>";
?>
<br>
Product number from Factory
<input type="text" name="pronum">
<br>
Product name
<input type="text" name="proname">
<br>
Product details
<input type="text" name="prodetails" size="50">
<br>
Box size
<input type="text" name="probox">
<br>
Quantity
<input type="text" name="proquantity">
<br>
Picture
<INPUT NAME="uploaded" TYPE="File">

<br>
Factory number
<input type="text" name="facnum">
<br>
Buy Price
<input type="text" name="price">
<br>
<input type="submit" name="Submit" value="Add record">
<br>
</form>

this is my PHP code i try to use but doesn't work

<?
$target = "databasepictures/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>

This doesn't work and if i Print the $target it shows only "databasepictures/"
What is wrong or waht is missing
Mar 25 '07 #1
1 1344
ronverdonk
4,258 Expert 4TB
Welcome to TSDN!

Please read the Posting Guidelines before you post in this forum!.

Especially the part about enclosing shown code within code or php tags! This is absolutely unreadable.

Also check the meaningfulness of your thread title. Everyone in this forum needs help with his/her code. So it really does not stick out.

moderator
Mar 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: drdoubt | last post by:
using namespace std In my C++ program, even after applying , I need to use the std namespace with the scope resolution operator, like, std::cout, std::vector. This I found a little bit...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
11
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
48
by: Chad Z. Hower aka Kudzu | last post by:
A few of you may recognize me from the recent posts I have made about Indy <http://www.indyproject.org/indy.html> Those of you coming to .net from the Delphi world know truly how unique and...
4
by: Phil | last post by:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and made into a TIF file and placed on the client (could be in temp internet dir). The reason we need it in TIF format is...
2
by: Keith Kowalski | last post by:
I anm opening up a text file reading the lines of the file that refer to a tif image in that file, If the tif image does not exist I need it to send an email stating that the file doesn't exist...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
4
by: Quas.co.ua | last post by:
Hello all. I need your help. I need C compler to make demo of some technologie. This C compiler I need to write program which after run will be located in one segment of memory and it...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.