How to find out which folder the user uploaded?

1

I would like to know how to find out which folder the user uploaded to the form?

For example, if the user uploaded to the X folder, if the file was inside the X folder, I'd like to execute the following code:

$upload = copy($arqTemp, $pasta . $nomePDF);
$pastaExcluir = "C:/Users/Administrador/Desktop/X/";    
unlink($pastaExcluir . $arqName);

Or if it did a upload from outside the specific folder I simply use move_uploaded_file() :

$upload = move_uploaded_file($arqTemp, $pasta . $pdfName);

So how will I find out which folder the file was sent to?

    
asked by anonymous 01.03.2017 / 14:37

1 answer

3

I understand you want to delete the file after the user uploaded it. Right?

Assuming so, you will not be able to do this. When the user does upload , you get the copy of that file and do whatever you want with it, but you do not have access to the client's file system or know how this file came from there.

If the application is running on the client's own computer, you have access to the file system, but you still have no way of knowing where the file came from. The browser does not provide this information.

If this is really very important, you might be able to use some plugin, creating some extension for the browser or something, which runs away from the PHP scope.

    
02.03.2017 / 17:29