You can try this,
$info = pathinfo($_FILES['userFile']['name']);
$ext = $info['extension']; // get the extension of the file
$newname = "newname.".$ext;
$target="images/".$newname;
move_uploaded_file( $_FILES['userFile']['tmp_name'], $target);
More Related Contents:
- how to set progress bar in file uploading using jquery? [closed]
- Multiple file upload in php
- How to rename uploaded file before saving it into a directory?
- How to check uploaded file type in PHP
- Multiple files upload in Codeigniter
- Multiple Image Upload PHP form with one input
- How to store file name in database, with other info while uploading image to server using PHP?
- PHP – Upload utf-8 filename
- Upload a file using file_get_contents
- How to limit file upload type file size in PHP?
- upload large files using php, apache
- Multiple image upload with CodeIgniter
- Increase max_execution_time in PHP?
- PHP ftp_put fails
- Can you re-populate file inputs after failed form submission with PHP or JavaScript?
- How to check if an uploaded file is an image without mime type?
- PHP Warning: move_uploaded_file() unable to move
- php file upload, how to restrict file upload type
- HTML Upload MAX_FILE_SIZE does not appear to work
- How to handle multiple file upload using PHP
- Codeigniter multiple file upload messes file extension
- simple file upload script [duplicate]
- How to access route, post, get etc. parameters in Zend Framework 2
- Setting PHP tmp dir – PHP upload not working
- PHP file upload: mime or extension based verification?
- How can I determine a file’s true extension/type programmatically?
- Secure User Image Upload Capabilities in PHP
- the dreaded “Warning: imagecreatefromjpeg() : ‘/tmp/filename’ is not a valid JPEG file in /phpfile.php on line xxx”
- Upload doesn’t work right when the file is too big
- PhP Upload progress in PhP 5.4 is not working. Session variables not set