Can anyone give an example in php how to upload a file to a server with a statusbar (you can without it).
|
2 answers
For the status of the bar, you need the jQuery plugin Uploadify, google it, you will find the manual how to put them in the network of cars. No progress bar
- We make the form form.html
- Making file upload.php
form.html
<form method="post" enctype="multipart/form-data" action="upload.php"> <input name="file" type="file"> <input type="submit" value="Загрузить"> </form>
upload.php
$folder='/files/'; move_uploaded_file($_FILES['file']['tmp_name'], $_SERVER['DOCUMENT_ROOT'].$folder.$filename);
Checks will complete yourself. The file will be uploaded to the files folder at the root of the web server. If the file is not loaded, then you need to set the folder write permissions 777.
|
With the status bar does not work, for this you need to use ajax, etc. To upload a file to the server using php, you need to use $ _FILES
|