06-08-2013, 02:09 AM | #1 |
Registered User
Join Date: Mar 2013
Posts: 246
|
How can we upload files in PHP?
Hi friends,
How can we upload files in PHP? i want that user can be post own resume file through forum. please tell me php script for that. thanks for any reply.
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. |
10-16-2013, 08:56 AM | #2 |
Registered User
Join Date: Oct 2013
Posts: 15
|
PHP Code:
|
10-21-2013, 06:21 AM | #3 |
Registered User
Join Date: Apr 2013
Location: Chennai
Posts: 72
|
<?php
$uploads_dir = '/uploads'; foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "$uploads_dir/$name"); } } ?>
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | |
10-23-2013, 05:36 AM | #4 |
Registered User
Join Date: Oct 2013
Posts: 5
|
html code for upload and submit button
<form action="userfile.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="Submit"> </form> //////// php code for upload file temporarily////////////////// <?php if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; } ?> //FOR PERMANENT STORAGE YOU HAVE TO MOVE FILE FROM TEMP TO OTHER FOLDER |
11-05-2013, 11:34 PM | #5 |
Registered User
Join Date: Sep 2013
Posts: 92
|
<html>
<body> <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="Submit"> </form> </body> </html>
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Importance of Php Development for Web Development | tech.biztech | Programming General | 35 | 11-22-2019 12:37 AM |
PHP introduction | stevepatton | PHP / mySQL | 48 | 06-17-2019 02:02 AM |
The best source of learn PHP easily at home. | chikkiarora | Programming General | 11 | 02-10-2013 02:18 AM |
PHP is an HTML-embedded scripting idiom | tommydenis | PHP / mySQL | 14 | 06-04-2012 02:15 AM |
Are you aware of the fact that PHP programming is the most widely used one? | johnrichards774 | PHP / mySQL | 3 | 02-07-2012 05:41 AM |