How do I check if an html file was generated in ftp and was generated, open it in the browser?

Asked

Viewed 68 times

0

I have a form, after filling and sending the form, a file is generated csv with the form data, the file is sent to an application on the server where it does the proper calculations and generates a file html in a folder in the ftp, would like to know how do I check the file html was generated and if generated, open it in the browser in the same tab where I sent the form.

The archive csv and the file html will have the same name.

while (!file_exists("$diretorio/$filehtm")) {
      sleep(1);
      header("Location: Link_Para_Ser_Redirecionado.htm");    
    }
  • have you ever googled or right here on the site? https://answall.com/questions/8041/verifica-se-um-ficheiro-existe-na-m%C3%A1quina-remoto-via-ftp-em-php

  • Yes, I did a Google search and here on the site and did some tests, but nothing effective

  • Post what you’ve tried, easier to help fix something that’s already started than a complete solution

  • I edited the post with Loop that I am having difficulty, it is not being redirected to htm file when it is generated in ftp

  • I managed to solve the problem, anyway, thanks for your help!

  • Cool Ian, then post the solution as an answer to get logged in if someone has the same question

Show 1 more comment

1 answer

0

Solution:

while (!file_exists(ftp://usuario:[email protected]/diretorio/arquivo)) sleep(1); //O sleep serve como intervalo no loop
    header("Location: http://link_para_ser_redirecionado.com"); 

Browser other questions tagged

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