|
||||||
| Database & Database Programming MySQL, Oracle, SQL, PL/SQL, ABAP, Smart Forms, and other databases and languages. A database is an organized body of related information used in many websites (including CC). |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
It's actually pretty easy to upload files, using PHP.
First of all, you need a form. The form have to have a enctype set to multipart/form-data. The input-tag you're using is gonna have file as type. Code:
<!-- upload.php (could even be upload.htm, because here's no PHP) -->
<form method="post" action="uploaded.php" enctype="multipart/form-data">
<b>Your file:</b><br />
<input type="file" name="file" /><br />
<input type="submit" value="Upload file" />
</form>
I'll show you the simplest way to do it, you can then continue further with the code. Code:
$upload_path = "uploads/";
$upload_path = $upload_path . basename($_FILES["file"]["name"]);
$status = move_uploaded_file($_FILES["file"]["tmp_name"], $upload_path);
if($status)
echo "<b>" . basename($_FILES["file"]["name"]) . "</b> uploaded!<br />";
else
echo "Error while uploading <b>" . basename($_FILES["file"]["name"]) . "</b><br />";
|
|
|||
|
Thank you for the reply, I have a couple questions: How does the code know what it is submitting when the button is clicked?
is the second part of code the upload.php file? or does that go into the base file? I am trying to have a string of texts from a textbox uploaded into a database table when the submit button is clicked. This shows how to upload a file? <-- big newb here, you gotta type slow for me =p |
|
|||
|
Ok ok, on the <form method="post" action="uploaded.php" enctype="multipart/form-data"> line, the action= "uploaded.php" actually has nothing to do with the data being uploaded? its just the page that is called after the button is clicked?
And the post method, how does it know what to post? And lol if you have more than one button how do you specify different actions for each? |
| Sponsored Links |
|
|
|
|||||
|
If you're gonna insert something into some database, you aren't going to do it in that way. Most databases, if not all, have some kind of API or framework to communicate with PHP - or another programming language. F.ex. PHP and MySQL.
I've only experience with PHP and the MySQL-database, but try take a search with Google or some other search engine to find information about the database you're using and/or programming language. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Project: ionFiles - Joomla Simple File Download | Jordan | Community Projects | 324 | 11-10-2008 08:34 PM |
| Project: ionFiles - Joomla Simple File Download - Mirror 2 | Jordan | ionFiles | 6 | 11-06-2008 01:24 PM |
| Simple Hex-Editing | TcM | Tutorials | 31 | 11-01-2008 10:51 AM |
| Simple gallery | Jaan | PHP Tutorials | 27 | 05-19-2008 05:56 PM |
| [Solved] yes/no box missing show release date | rolandd | ionFiles | 4 | 07-26-2007 01:44 PM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |
Goal: 100,000 Posts
Complete: 98%