PDA

View Full Version : How can we upload files in PHP?



noahwilson
06-10-2013, 02:16 AM
Hi friends,
How can we upload files in PHP? i want that user can be post own resume file through form. please tell me php script for that.
thanks for any reply.

josephlimma
07-12-2013, 05:52 AM
Create an Upload-File Form

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">

Create The Upload Script
<?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"];
}
?>

webcreations
07-15-2013, 03:22 AM
Same coding is used for uploading php files as discussed by josephlimma.

mairawimble
07-15-2013, 09:11 AM
Interesting and very informative , useful post. Thanks for sharing with us.

portable display stands (http://www.miradisplays.com/display-stands/) | portable counters (http://www.miradisplays.com/promotional-counters/)

luceleng
07-18-2013, 01:42 AM
is there any real thread with real discussion in this forum?

saira
07-30-2013, 02:25 AM
Hi Luceleng, above thread is real discussion, what kind of discussion and real thread you are looking for here.

umairfsd
09-19-2013, 07:10 AM
<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>

akashram
10-04-2014, 07:18 AM
<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>

<?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"];
}
?>

</body>
</html>

Sameer Shoakat
10-20-2014, 05:15 AM
Hi there,
Actually PHP is very demanded tool in SEO because that coding is very amazed for any content but no doubt that is to hard and complicated so that,s why mostly people avoid that because they don,t spent time for it because they don,y know about his very value able aspects that to batter for website growing with PHP .

Regards:
Sameer shokat.

Olin Lamanna
10-20-2014, 09:38 PM
I find it very helpful: http://www.w3schools.com/php/php_file_upload.asp. This can be helpful to you too.

sanamgupta
02-14-2015, 01:38 AM
thanks for the information that you share with us :) you can also read from w3schools.com

Geekion
02-16-2015, 05:49 PM
always check for open-source scripts on sourceforge and read the code to know how it works

chrisgeitz
02-23-2015, 01:30 AM
Wix.com provides a free, easy-to-use online system that allows you create and post your own unique web page. Its highly effective modifying resources & personalized web page styles make building a wonderful web page simple.