• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

how to upload a file via web browser?

Could someone please describe (in detail please!) how I can create a page where people can upload files to a directory in my website?

Thank you!  (support for php and stuff, but I have no idea how to use them)
0
galneweinhaw
Asked:
galneweinhaw
2 Solutions
 
Jaime OlivaresCommented:
Since is a common question, have a look to this previous answer:
http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_10810564.html
If you have any doubt, please advice.
0
 
Juan OcasioCommented:
Here is a simple way:

input.html:

<html>
<!--upload.html-->
     <FORM ACTION="upload.php" METHOD=POST ENCTYPE="multipart/form-data">
      Submit this File: <INPUT TYPE=FILE NAME="theFile"><BR>
      <INPUT TYPE=SUBMIT><BR>
     </FORM>
</HTML>



upload.php:
<html>
    <?
      if(copy($theFile, "locationToSaveFile"))
      {      
           echo("File upload successful");
      }
      else
      {    
           echo("File upload unsuccessful");
      }

      unlink($theFil); //destroys file  
     ?>

</HTML>

hope this helps a bit

jocasio
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now