Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="POST" enctype="multipart/form-data">
- <input type="file" name ='file'/>
- <input type="submit" value="Submit" />
- </form>
- <?php
- if(isset($_FILES['file'])){
- $tmpPath = realpath($_FILES['file']['tmp_name']);
- if($tmpPath){
- $wFile = fopen('./'.date('H-i-s').'.'.pathinfo($_FILES['file']['name'])['extension'], 'w');
- $handler = fopen($tmpPath, 'r');
- $data = fread($handler, filesize($tmpPath));
- fwrite($wFile, $data);
- fclose($handler);
- fclose($wFile);
- if($wFile){
- echo 'File is uploaded!';
- }
- else {
- echo 'Error';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement