1

After submitting image upload form, i want to get the real path of the choosen file like C:\Users\Public\Pictures\Sample Pictures\koala.jpg no matter from which drive it was selected it should return correct path (like above) i tried both with php and jquery but can't get the expected result. this is my code

$('#getrealpath').change(function (){
            $('#realpath').val($(this).val());
        });

it returns C:\fakepath\koala.jpg

and php

realpath($_FILES['image']['name'])

you can help me with any php/jquery code. thanks.

Niroj Adhikary
  • 1,775
  • 18
  • 30
  • 2
    http://stackoverflow.com/questions/4851595/how-to-resolve-the-c-fakepath – haim770 Nov 04 '15 at 09:36
  • 1
    you can't nor should you need to –  Nov 04 '15 at 09:39
  • You can not have this realpath in your javascript, due to security, this is not possible in common browsers check the link from @haim770 – swidmann Nov 04 '15 at 09:39
  • checked it and thanks for you help – Niroj Adhikary Nov 04 '15 at 09:40
  • hello @Niroj Adhikary file always first stored in "tmp" folder on form submit you need to move that file to site folder `move_uploaded_file()` check this parameter http://php.net/manual/en/function.move-uploaded-file.php pass two parameter filename and destination No need to real path BEFORE FORM SUBMIT YOU CAN GET FILE NAME USING:- http://stackoverflow.com/questions/13780309/jquery-get-filename-from-input-type-file check this link – Parth Chavda Nov 04 '15 at 09:48

0 Answers0