0

I want that the path from which the file is uploaded C:\\xampp\\htdocs\\cmd is coming from dirname(__FILE__), but when i do that the script throws an error.

Working code

exec( dirname(__FILE__)."\\xyz.exe C:\\xampp\\htdocs\\cmd\\blue.png D:\\1.png\", $output);

But I want:

exec( dirname(__FILE__)."\\xyz.exe" dirname(__FILE__)."\\blue.png D:\\1.png\", $output);
2
  • 1
    try __DIR__ instead of dirname() Commented Oct 16, 2012 at 8:34
  • You need to share the error it throws. Commented Oct 16, 2012 at 8:40

1 Answer 1

1

Why not chdir before executing all:

$imagename = 'blue.png';
$command = 'chdir ' . __DIR__ . '; xyz.exe ' . $imagename . ' D:\\1.png\\ ';
exec( $command, $output);
Sign up to request clarification or add additional context in comments.

3 Comments

by using chdir image cannot save to 'D:\\1.png\\' path it save in DIR path from where the image is upload
thanks for help one more help how to use string instead of blue.png i.e if i want to give image name dynamically using file uploader $command = 'chdir ' . DIR . '; xyz.exe ' .$file_name. '1.png';
it cannot work 'chdir' contain no directory from where the file upload

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.