Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Upload feature in my form
Old 07-05-2006, 11:57 AM Upload feature in my form
Average Talker

Posts: 27
Location: Holland Amsterdam
Trades: 0
Hi there i would like to add an upload feature to my form i have a basic form

1. name
2. email
3. comments

but i would like to add the upload feature in the same form, i think this is the code but i do not know the right way to do this


<html>
<head>
<title>Upload</title>
<body>

<?php

$uploaddir = '/home/username/public_html/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

?>

</body>

my question is, should i work this piece of code as apart .PHP file or try to insert it the .PHP file of my form actual form.

Thanks in advance

Last edited by latintrans; 07-05-2006 at 11:58 AM..
latintrans is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-09-2006, 06:05 PM Re: Upload feature in my form
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
If I understand your question correctly, you can have the html form and php script on the same page. Just use $_SERVER['PHP_SELF'] as the form action, and then use conditions to either process form data or display html form.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Upload feature in my form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.47104 seconds with 12 queries