0

I have a PHP script that I am testing with XAMPP that will have a user upload a file, run file through Python script, then output an output Excel file. Everything works great on my local machine. However I want to put this tool on my works internal server (running Ubuntu Linux) so everyone can use the tool. The issue I am running into is that in my PHP script, I check the client's directory to ensure that the output directory is created, if not it is created for them. Since the tool has been moved to the Linux side, I am unsure how I can reference the users directories to check to see if a specific folder exist, or even to specify that location that output should be written.

One thought I had was to call a Python script to SFTP the selected file over to the Linux side, run the process, then SFTP the output file. However, the issue I have found is that I need to know the full path to the file in order to do so, and the upload process only seems to capture the file name itself (for security reasons I understand). Ultimately I could use a suggestion on how I can take this working PHP/Python process using XAMPP, and move it to a local Linux server and still be able to check the Windows file directories and create a Windows folder if needed.

Garrett
  • 107
  • 10
  • The web service should have no knowledge of the client file system. To do otherwise is likely creating a security issue within your application. You should be able to use existing file upload tools for your frontend client that submit the file to your service and then program the service to return it as a "saveable" file. – Steve Boyd Mar 10 '19 at 19:56
  • Ok that makes sense. I'll have to dig further into the upload tools. Thank you. – Garrett Mar 10 '19 at 20:18
  • The answers to these questions might help: https://stackoverflow.com/questions/35253550/upload-a-file-using-php and https://stackoverflow.com/questions/7263923/how-to-force-file-download-with-php?rq=1 – Steve Boyd Mar 10 '19 at 20:30
  • Thanks for those. I think I need to get a better understanding of what exactly is happening to the file during an upload. From my testing, I only obtained the file name from from the upload, but if I can come up with a way to force the upload to copy the file to the server side, then I could run my process on the file from that location. sorry for the run on sentence – Garrett Mar 11 '19 at 04:11

0 Answers0