View previous topic :: View next topic |
Author |
Message |
jsrds -
Joined: 30 Dec 2014 Posts: 1 Location: Sri Lanka
|
Posted: Tue Dec 30, 2014 2:34 pm Post subject: php ajax file uploader |
|
|
Hi!
I have been facing an issue with php ajax File uploader that has the drag drop area to drop Files and then it uploads. It is changing the File Extension to none when uploads to server. any body can help? _________________ JOSEPH S R DE SARAM
CISSP FBCS CITP MSCS MACS Snr CP SAP FI SAP BW |
|
Back to top |
|
|
badai -
Joined: 24 Apr 2003 Posts: 82
|
Posted: Wed Feb 18, 2015 5:36 pm Post subject: |
|
|
i think that's what php do, use random string to name the temp file. you can easily rename it to anything you want. |
|
Back to top |
|
|
Toasty -
Joined: 21 Feb 2008 Posts: 298 Location: Chicago, IL
|
Posted: Wed Dec 16, 2015 5:42 pm Post subject: |
|
|
The original file name is in $_FILES['yourfieldname']['name']
The temporary file is in $_FILES['yourfieldname']['tmp_name']
So grab the extension off the first one:
Code: |
<?php
$fileName = $_FILES['yourfieldname']['name'];
$extension = array_pop(explode('.',$fileName));
echo $extension;
|
_________________ Audit the secure configuration of your server headers! |
|
Back to top |
|
|
|