Send file to website and pick up the file path

Asked

Viewed 743 times

1

I would like to send a file to a input guy file and recover the complete file path. If anyone knows anything like that will be very useful to me.

  • 2

    What language are you using?

  • 1

    PHP or JAVASCRIPT

  • What is the use of this??? I see no other than trying to hack some site

  • You want to upload and get the file path on the server, or get the path on the client machine?

  • I’m making an intranet where people have to put the server path. To facilitate I need the person to choose the file and I will save the path in the database.

  • Which language you use or will use?

  • I’m sorry, but it’s still unclear. If you are trying to take the local file path (before uploading) via javascript, this does not work in some browsers, for security reasons.

  • To try to clarify, the user drags a file to the drag-n-drop, when that file falls in that area, you want to extract the local path of the same type c:\bananas\homem.txt and store in the database, that’s it?

  • That’s right. How can I?

  • Someone has the answer??

Show 5 more comments

1 answer

1

$caminhoArquivo = "";
$diretorio = $_POST['nome_diretorio'];

if (file_exists($diretorio)&&is_dir($diretorio )) {
    // mova o upload para esse diretório
    caminhoArquivo = $diretorio."/".$nomeUpload;
} else {
    // como o diretório informado não existe, é preciso criá-lo
    if (mkdir($diretorio , 0777)) {
        // mova o upload para esse diretório
        caminhoArquivo = $diretorio."/".$nomeUpload;
    } else {
        echo "Falha ao criar diretório";
    }
}
  • You could explain your solution?

  • I don’t quite understand your explanation.

  • -1, because apparently has no relation to the question. I will reverse if clarification occurs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.