background preloader

Tutorials web building

Facebook Twitter

File Upload. A very useful aspect of PHP is its ability to manage file uploads to your server. Allowing users to upload a file to your server opens a whole can of worms, so please be careful when enabling file uploads. Before you can use PHP to manage your uploads, you must first build an HTML form that lets users select a file to upload. See our HTML Form lesson for a more in-depth look at forms. HTML Code: <form enctype="multipart/form-data" action="uploader.php" method="POST"><input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /><input type="submit" value="Upload File" /></form> Here is a brief description of the important parts of the above code: Save that form code into a file and call it upload.html.

Display: After the user clicks submit, the data will be posted to the server and the user will be redirected to uploader.php. The file is too large and you do not want to have it on your server. PHP Code: Online Web Tutorials. JavaScript Tutorial: Home. Welcome to Ecma International. Tizag Tutorials.