Pergunta

I want to integrate the uploadify to my legacy application.

I am not able to find the way to send some variable (name of file) to my current legacy file. (That file has database code to store the file along with other form parameter in common table).

Could you please tell me how can I send the name of files which are being uploaded by uplodify to my legacy php file.

Foi útil?

Solução

In uploadify, once you have the filename of the uploaded file, you can call your old code using:

file_get_contents("http://yoursite.com/legacy.php?filename=" . urlencode($filename));

And then in legacy.php:

if($_FILES['picture1']['name']){
    $filename = $_FILES['picture1']['name'];
}else if(isset($_GET['filename'])){
    $filename = $_GET['filename'];
}

It would be a good idea to do a sanity check and make sure that $_GET['filename'] is located in a directory where you're expecting uploaded files, and isn't something like "/etc/shadow", since legacy.php is likely accessible to the outside web.

This isn't the best or most secure way to accomplish what you want, but it's probably the quickest and simplest.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top