- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
move_uploaded_file() function in PHP
The move_uploaded_file() function moves an uploaded file to a new location. If the destination file already exists, it will be overwritten.
Syntax
move_uploaded_file(file_path, moved_path)
Parameters
file_path − The file to be moved.
moved_path − Where the file will be moved.
Return
The move_uploaded_file() function returns true on success and false on failure.
Example
<?php if (move_uploaded_file($_FILES['userfile']['tmp_name'], "/documents/new/")) { print "Uploaded successfully!"; } else { print "Upload failed!"; } ?>
Output
Upload failed!PHP Notice: Undefined index: userfile in /home/cg/root/8944881/main.php on line 2
Advertisements