![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2005
Posts: 20
Rep Power: 0
![]() |
upload then be shown on html page
hi
i wanted to know if there is a way i could set up some like this a form with this name: password: image: browse email: submit and when they click submit it will get sent to my server and end up on a page so everyone can see it and will look something like this image name: email: would you be the best if you can help me out Aaron |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: MA, US
Posts: 204
Rep Power: 4
![]() |
you need to use a server side language... have the HTML form post to a PHP page like this:
HTML: <form enctype="multipart/form-data" action="submit.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000" /> <table> <tr> <td>Name: </td> <td><input type="text" name="name"></td> <td>Password: </td> <td><input type="password" name="passwd"></td> <td>File: </td> <td><input type="file" name="userfile"></td> <td>email: </td> <td><input type="text" name="email"></td> </tr> </table> <input name="action" type="submit" value="Submit"> </form> PHP: (upload code) $uploadDir = 'uploads/';
$filename=trim($_FILES['userfile']['name']);
$uploadFile = $uploadDir . $filename;
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadFile)) {
print "file was successfully uploaded. <br />";
}
else {
print "Upload failed! Here's some debugging info: \n";
print_r($_FILES);
}and if you are going to do anything with the other fields you should think about using a MySQL database. go to http://www.php.net/mysql for some more info on that.
__________________
"A stupid man's report of what a clever man says can never be accurate, because he unconciously translates what he hears into something he can understand." - B. Russell http://web.bryant.edu/~srk2 |
|
|
|
|
|
#3 |
|
Newbie
Join Date: May 2005
Posts: 20
Rep Power: 0
![]() |
umm i'm abit confused sorry so how does it like get on the html page ?? i know about the uploading but ?????????????????? agh soz
|
|
|
|
|
|
#4 | |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: MA, US
Posts: 204
Rep Power: 4
![]() |
Quote:
I will get you a code snippet eventually if you get stuck.
__________________
"A stupid man's report of what a clever man says can never be accurate, because he unconciously translates what he hears into something he can understand." - B. Russell http://web.bryant.edu/~srk2 |
|
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
If you are going to attempt something like this, you REALLY need to do some basic research on how the typical client/server relationship works. I say this because Skuinder's posts are apparently greek to you.
When the user types an address into the browser and clicks go, the address is resolved, a connection is established with the correct server, and the server responds to the request. If the request is for a static, informational page, the server sends that and closes the connection. If the request is for a dynamic (executable) page, the server executes the code on the requested page. That page typically generates HTML information, sends it to the browser to be rendered, and closes the connection. The processing which results in generating the information to be rendered on the client's system may interact with any number of things, including files and databases on the server system. Because the typical interaction is a connect - request - response - disconnect sequence, there is no real interaction between the client and server on anything approaching a realtime basis. In other words, don't think that mouse clicks, etc., on the browser are being monitored by the program running on the server. Once you have familiarized yourself with the basics and with one of a number of languages suitable for use on the server, you will find that you are ready to consider something like MySQL as an adjunct to your application. It isn't all that difficult to come up to speed on. You MUST understand your environment, and you MUST understand how you are going to design your application. Pursuing ANY language, or ANY set of tools is premature until you have done that.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|