Help with File Upload
Moderator: General Moderators
-
maverickbce8
- Forum Newbie
- Posts: 7
- Joined: Sun May 14, 2006 10:56 pm
Help with File Upload
i can find alot of file upload tutorials using PHP, and i can get started by creating the forum with html. I get stuck when i have to start using the php. I dont know where to save the php file and what i have to do to get the file upload to work correctly for my website. Please help....
show us what you have so far....
you'll need to get familiar with the $_FILES array and some of the functions that involve uploading files ie (is_uploaded_file(), move_uploaded_file(), etc).
best thing to do, is hit up the manual for assistance with those and then come back here with any specific problems you might have.
you'll need to get familiar with the $_FILES array and some of the functions that involve uploading files ie (is_uploaded_file(), move_uploaded_file(), etc).
best thing to do, is hit up the manual for assistance with those and then come back here with any specific problems you might have.
-
maverickbce8
- Forum Newbie
- Posts: 7
- Joined: Sun May 14, 2006 10:56 pm
i get to the point where i creat the forum for the browse, and submit buttons, where that works.. Its just past that where i get stuck
ex: "After the user clicks submit, the data will be posted to the server and the user will be redirected to uploader.php. This PHP file is going to process the form data and do all the work."
"Now we can finally start to write a basic PHP upload manager script! Here is how we would get the temporary file name, choose a permanent name, and choose a place to store the file.
PHP Code:
// Where the file is going to be placed
$target_path = "uploads/";
/* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
// This is how we will get the temporary file...
$_FILES['uploadedfile']['tmp_name'];
NOTE: You will need to create a new directory in the directory where uploader.php resides, called "uploads", as we are going to be saving files there."
The directions seem vague to me.....how do i make that php script work with the html code that made the original forum
ex: "After the user clicks submit, the data will be posted to the server and the user will be redirected to uploader.php. This PHP file is going to process the form data and do all the work."
"Now we can finally start to write a basic PHP upload manager script! Here is how we would get the temporary file name, choose a permanent name, and choose a place to store the file.
PHP Code:
// Where the file is going to be placed
$target_path = "uploads/";
/* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
// This is how we will get the temporary file...
$_FILES['uploadedfile']['tmp_name'];
NOTE: You will need to create a new directory in the directory where uploader.php resides, called "uploads", as we are going to be saving files there."
The directions seem vague to me.....how do i make that php script work with the html code that made the original forum
I wrote an image upload tutorial that's supposedly under review by the tutorials group. I've seen a whole bunch of image uploading problems lately.
Anyhoo,
the file that's uploaded will be in an array called $_FILES
if you do this
You'll see a bunch of information about what was uploaded.
It is saved (temporarily) on your server (most likely in the /tmp directoy)
You'll need to become familiar with move_uploaded_file() and basic file handling functions.
Anyhoo,
the file that's uploaded will be in an array called $_FILES
if you do this
Code: Select all
echo '<pre>';
print_r($_FILES);
echo '</pre>';It is saved (temporarily) on your server (most likely in the /tmp directoy)
You'll need to become familiar with move_uploaded_file() and basic file handling functions.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
-
maverickbce8
- Forum Newbie
- Posts: 7
- Joined: Sun May 14, 2006 10:56 pm